From cc7a725ae870addf297e24b81784e5fa69a048b4 Mon Sep 17 00:00:00 2001 From: Karl W Schulz Date: Thu, 7 Mar 2024 10:24:46 -0600 Subject: [PATCH] add a profileMode option to capture_subprocess_output() - includes indented output with profiler selection when enabled Signed-off-by: Karl W Schulz --- src/utils/utils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/utils/utils.py b/src/utils/utils.py index 97617dade9..b9218e7061 100644 --- a/src/utils/utils.py +++ b/src/utils/utils.py @@ -161,7 +161,7 @@ def detect_rocprof(): return rocprof_cmd # TODO: Do we still need to return this? It's not being used in the function call -def capture_subprocess_output(subprocess_args, new_env=None): +def capture_subprocess_output(subprocess_args, new_env=None, profileMode=False): # Start subprocess # bufsize = 1 means output is line buffered # universal_newlines = True is required for line buffering @@ -192,7 +192,10 @@ def capture_subprocess_output(subprocess_args, new_env=None): # line to read when this function is called line = stream.readline() buf.write(line) - sys.stdout.write(line) + if profileMode: + console_log(rocprof_cmd,line.strip(),indent_level=1) + else: + console_log(line.strip()) # Register callback for an "available for read" event from subprocess' stdout stream selector = selectors.DefaultSelector()