diff --git a/src/rocprof_compute_profile/profiler_rocprof_v1.py b/src/rocprof_compute_profile/profiler_rocprof_v1.py index 4ee1c141c..7e083ee42 100644 --- a/src/rocprof_compute_profile/profiler_rocprof_v1.py +++ b/src/rocprof_compute_profile/profiler_rocprof_v1.py @@ -25,7 +25,7 @@ import os from rocprof_compute_profile.profiler_base import RocProfCompute_Base -from utils.utils import console_log, demarcate, replace_timestamps +from utils.utils import console_log, demarcate, replace_timestamps, store_app_cmd class rocprof_v1_profiler(RocProfCompute_Base): @@ -50,6 +50,16 @@ def get_profiler_options(self, fname): # v1 does require quotes on app cmd '"' + app_cmd + '"', ] + # store original args for debug message + store_app_cmd( + [ + "--timestamp", + "on", + "-o", + self.get_args().path + "/" + fbase + ".csv", + app_cmd, + ] + ) return args # ----------------------- diff --git a/src/rocprof_compute_profile/profiler_rocprof_v2.py b/src/rocprof_compute_profile/profiler_rocprof_v2.py index 5f2709097..1b2d21adb 100644 --- a/src/rocprof_compute_profile/profiler_rocprof_v2.py +++ b/src/rocprof_compute_profile/profiler_rocprof_v2.py @@ -26,7 +26,7 @@ import shlex from rocprof_compute_profile.profiler_base import RocProfCompute_Base -from utils.utils import console_log, demarcate, replace_timestamps +from utils.utils import console_log, demarcate, replace_timestamps, store_app_cmd class rocprof_v2_profiler(RocProfCompute_Base): @@ -47,6 +47,8 @@ def get_profiler_options(self, fname): self.get_args().path + "/" + "out", ] args.extend(app_cmd) + # store args for debug message + store_app_cmd(args) return args # ----------------------- diff --git a/src/utils/utils.py b/src/utils/utils.py index 8928b2a92..575264008 100644 --- a/src/utils/utils.py +++ b/src/utils/utils.py @@ -44,6 +44,7 @@ import config rocprof_cmd = "" +rocprof_args = "" def demarcate(function): @@ -186,8 +187,16 @@ def detect_rocprof(): return rocprof_cmd # TODO: Do we still need to return this? It's not being used in the function call +def store_app_cmd(args): + global rocprof_args + rocprof_args = args + + def capture_subprocess_output(subprocess_args, new_env=None, profileMode=False): - console_debug("subprocess", subprocess_args) + global rocprof_args + # Format command for debug messages, formatting for rocprofv1 and rocprofv2 + command = " ".join(rocprof_args) + console_debug("subprocess", "Running: " + command) # Start subprocess # bufsize = 1 means output is line buffered # universal_newlines = True is required for line buffering