Resguardo inicial

This commit is contained in:
lastdragon
2026-09-06 12:53:21 -06:00
parent 662efe3c2a
commit ad2088d178
94853 changed files with 43200404 additions and 0 deletions
+57
View File
@@ -0,0 +1,57 @@
#!/usr/bin/env drgn
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2025 Juri Lelli <juri.lelli@redhat.com>
# Copyright (C) 2025 Red Hat, Inc.
desc = """
This is a drgn script to show dl_rq bandwidth accounting information. For more
info on drgn, visit https://github.com/osandov/drgn.
Only online CPUs are reported.
"""
import os
import argparse
import drgn
from drgn import FaultError
from drgn.helpers.common import *
from drgn.helpers.linux import *
def print_dl_bws_info():
print("Retrieving dl_rq bandwidth accounting information:")
runqueues = prog['runqueues']
for cpu_id in for_each_possible_cpu(prog):
try:
rq = per_cpu(runqueues, cpu_id)
if rq.online == 0:
continue
dl_rq = rq.dl
print(f" From CPU: {cpu_id}")
# Access and print relevant fields from struct dl_rq
print(f" running_bw : {dl_rq.running_bw}")
print(f" this_bw : {dl_rq.this_bw}")
print(f" extra_bw : {dl_rq.extra_bw}")
print(f" max_bw : {dl_rq.max_bw}")
print(f" bw_ratio : {dl_rq.bw_ratio}")
except drgn.FaultError as fe:
print(f" (CPU {cpu_id}: Fault accessing kernel memory: {fe})")
except AttributeError as ae:
print(f" (CPU {cpu_id}: Missing attribute for root_domain (kernel struct change?): {ae})")
except Exception as e:
print(f" (CPU {cpu_id}: An unexpected error occurred: {e})")
if __name__ == "__main__":
parser = argparse.ArgumentParser(description=desc,
formatter_class=argparse.RawTextHelpFormatter)
args = parser.parse_args()
print_dl_bws_info()
@@ -0,0 +1,68 @@
#!/usr/bin/env drgn
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2025 Juri Lelli <juri.lelli@redhat.com>
# Copyright (C) 2025 Red Hat, Inc.
desc = """
This is a drgn script to show the current root domains configuration. For more
info on drgn, visit https://github.com/osandov/drgn.
Root domains are only printed once, as multiple CPUs might be attached to the
same root domain.
"""
import os
import argparse
import drgn
from drgn import FaultError
from drgn.helpers.common import *
from drgn.helpers.linux import *
def print_root_domains_info():
# To store unique root domains found
seen_root_domains = set()
print("Retrieving (unique) Root Domain Information:")
runqueues = prog['runqueues']
def_root_domain = prog['def_root_domain']
for cpu_id in for_each_possible_cpu(prog):
try:
rq = per_cpu(runqueues, cpu_id)
root_domain = rq.rd
# Check if we've already processed this root domain to avoid duplicates
# Use the memory address of the root_domain as a unique identifier
root_domain_cast = int(root_domain)
if root_domain_cast in seen_root_domains:
continue
seen_root_domains.add(root_domain_cast)
if root_domain_cast == int(def_root_domain.address_):
print(f"\n--- Root Domain @ def_root_domain ---")
else:
print(f"\n--- Root Domain @ 0x{root_domain_cast:x} ---")
print(f" From CPU: {cpu_id}") # This CPU belongs to this root domain
# Access and print relevant fields from struct root_domain
print(f" Span : {cpumask_to_cpulist(root_domain.span[0])}")
print(f" Online : {cpumask_to_cpulist(root_domain.span[0])}")
except drgn.FaultError as fe:
print(f" (CPU {cpu_id}: Fault accessing kernel memory: {fe})")
except AttributeError as ae:
print(f" (CPU {cpu_id}: Missing attribute for root_domain (kernel struct change?): {ae})")
except Exception as e:
print(f" (CPU {cpu_id}: An unexpected error occurred: {e})")
if __name__ == "__main__":
parser = argparse.ArgumentParser(description=desc,
formatter_class=argparse.RawTextHelpFormatter)
args = parser.parse_args()
print_root_domains_info()