2
0

Added pcie bandwith to metric --pcie

Change-Id: I12d070ca8e4ad0606d5d2c843cdffdcd83007350
Signed-off-by: Maisam Arif <maisarif@amd.com>
Este cometimento está contido em:
Maisam Arif
2023-09-22 07:40:26 -05:00
cometido por Maisam Arif
ascendente 901b9e8331
cometimento e079032d0e
+25 -1
Ver ficheiro
@@ -999,7 +999,10 @@ class AMDSMICommands():
if args.pcie:
pcie_dict = {'current_width': "N/A",
'current_speed': "N/A",
'replay_count' : "N/A"}
'replay_count' : "N/A",
'current_bandwith_sent': "N/A",
'current_bandwith_received': "N/A",
'max_packet_size': "N/A"}
try:
pcie_link_status = amdsmi_interface.amdsmi_get_pcie_link_status(args.gpu)
@@ -1024,6 +1027,27 @@ class AMDSMICommands():
except amdsmi_exception.AmdSmiLibraryException as e:
logging.debug("Failed to get pci replay counter for gpu %s | %s", args.gpu, e.get_error_info())
try:
pcie_bw = amdsmi_interface.amdsmi_get_gpu_pci_throughput(args.gpu)
sent = pcie_bw['sent'] * pcie_bw['max_pkt_sz']
received = pcie_bw['received'] * pcie_bw['max_pkt_sz']
if self.logger.is_human_readable_format():
if sent > 0:
sent = sent // 1024 // 1024
sent = f"{sent} MB/s"
if received > 0:
received = received // 1024 // 1024
received = f"{received} MB/s"
pcie_bw['max_pkt_sz'] = f"{pcie_bw['max_pkt_sz']} B"
pcie_dict['current_bandwith_sent'] = sent
pcie_dict['current_bandwith_received'] = received
pcie_dict['max_packet_size'] = pcie_bw['max_pkt_sz']
except amdsmi_exception.AmdSmiLibraryException as e:
logging.debug("Failed to get pcie bandwidth for gpu %s | %s", args.gpu, e.get_error_info())
values_dict['pcie'] = pcie_dict
if args.fan:
try: