Enabled events subcommand to non-virtual systems

Signed-off-by: Maisam Arif <maisarif@amd.com>
Change-Id: Ied56ef015bba606b1bca1a1108a237d0c1cc7fdb
This commit is contained in:
Maisam Arif
2023-10-16 07:20:13 -05:00
committed by Galantsev, Dmitrii
parent 5405615062
commit ec24a0f66d
4 changed files with 36 additions and 21 deletions
+24 -6
View File
@@ -1526,13 +1526,31 @@ class AMDSMICommands():
print('Not applicable to linux baremetal')
def event(self, args):
def event(self, args, gpu=None):
""" Get event information for target gpus
Args:
args (Namespace): argparser args to pass to subcommand
gpu (device_handle, optional): device_handle for target device. Defaults to None.
Return:
stdout event information for target gpus
"""
if args.gpu:
gpu = args.gpu
if gpu == None:
args.gpu = self.device_handles
if not isinstance(args.gpu, list):
args.gpu = [args.gpu]
print('EVENT LISTENING:\n')
print('Press q and hit ENTER when you want to stop (listening will stop inside 10 seconds)')
print('Press q and hit ENTER when you want to stop (listening will stop within 10 seconds)')
threads = []
for i in range(len(self.device_handles)):
x = threading.Thread(target=self._event_thread, args=(self, i))
for gpu in range(len(args.gpu)):
x = threading.Thread(target=self._event_thread, args=(self, gpu))
threads.append(x)
x.start()
@@ -2058,8 +2076,8 @@ class AMDSMICommands():
return
device = devices[i]
listener = amdsmi_interface.AmdSmiEventReader(device, amdsmi_interface.AmdSmiEvtNotificationType.GPU_PRE_RESET,
amdsmi_interface.AmdSmiEvtNotificationType.GPU_POST_RESET)
listener = amdsmi_interface.AmdSmiEventReader(device,
amdsmi_interface.AmdSmiEvtNotificationType)
values_dict = {}
while self.stop!='q':
+2 -2
View File
@@ -564,8 +564,8 @@ class AMDSMIParser(argparse.ArgumentParser):
def _add_event_parser(self, subparsers, func):
if self.helpers.is_linux() and not self.helpers.is_virtual_os():
# This subparser only applies to Linux Hypervisors, NOT Linux Guest
if self.helpers.is_virtual_os():
# This subparser doesn't only apply to guest systems
return
# Subparser help text