Fix for GitHub Issue #24: Update Event Stop Behavior

amd-smi event is failing to exit as it waits for all threads to complete before exiting. Each thread has to listen for a maximum of 10 seconds prior to exiting in the current implementation.

Lowered individual listen time for _event_thread allowing for a quicker exit while still capturing all events (Looped until escape sequence detected).

Added logging for escape character, not sure if needed but helps confirm that key press was registered.

Change-Id: I916608754798f966980a558342c7c62693252d7f


[ROCm/amdsmi commit: d263b53797]
Bu işleme şunda yer alıyor:
Harkirat Gill
2024-09-18 09:59:43 -04:00
işlemeyi yapan: Maisam Arif
ebeveyn fbb1071046
işleme e73ae3d79d
+11 -7
Dosyayı Görüntüle
@@ -2816,16 +2816,20 @@ class AMDSMICommands():
args.gpu = [args.gpu]
print('EVENT LISTENING:\n')
print('Press q and hit ENTER when you want to stop (listening will stop within 10 seconds)')
print('Press q and hit ENTER when you want to stop.')
self.stop = False
threads = []
for device_handle in range(len(args.gpu)):
x = threading.Thread(target=self._event_thread, args=(self, device_handle))
threads.append(x)
x.start()
while self.stop!= 'q':
self.stop = input("")
while True:
user_input = input()
if user_input == 'q':
print("Escape Sequence Detected; Exiting")
self.stop = True
break
for thread in threads:
thread.join()
@@ -4956,9 +4960,9 @@ class AMDSMICommands():
amdsmi_interface.AmdSmiEvtNotificationType)
values_dict = {}
while self.stop!='q':
while not self.stop:
try:
events = listener.read(10000)
events = listener.read(2000)
for event in events:
values_dict["event"] = event["event"]
values_dict["message"] = event["message"]
@@ -4970,4 +4974,4 @@ class AMDSMICommands():
except Exception as e:
print(e)
listener.stop()
listener.stop()