From a33b1cc58d3f8b633d3ac6047ad6109651a3c67d Mon Sep 17 00:00:00 2001 From: Evgeny Date: Thu, 17 Jan 2019 02:25:08 -0600 Subject: [PATCH] ctx-wait option Change-Id: I8a7cf97458f27169774e3a38ee5007b2ca6bf450 [ROCm/rocprofiler commit: 4c0c64493cb71d45868e5298edcee139f4137a35] --- projects/rocprofiler/bin/rpl_run.sh | 6 ++++++ projects/rocprofiler/test/tool/tool.cpp | 8 ++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/projects/rocprofiler/bin/rpl_run.sh b/projects/rocprofiler/bin/rpl_run.sh index ef97968d0d..1ae7da36ff 100755 --- a/projects/rocprofiler/bin/rpl_run.sh +++ b/projects/rocprofiler/bin/rpl_run.sh @@ -241,6 +241,12 @@ while [ 1 ] ; do else export ROCP_TIMESTAMP_ON=0 fi + elif [ "$1" = "--ctx-wait" ] ; then + if [ "$2" = "on" ] ; then + export ROCP_OUTSTANDING_WAIT=1 + else + export ROCP_OUTSTANDING_WAIT=0 + fi elif [ "$1" = "--ctx-limit" ] ; then export ROCP_OUTSTANDING_MAX="$2" elif [ "$1" = "--heartbeat" ] ; then diff --git a/projects/rocprofiler/test/tool/tool.cpp b/projects/rocprofiler/test/tool/tool.cpp index 14723343c7..27aa2ba4e0 100644 --- a/projects/rocprofiler/test/tool/tool.cpp +++ b/projects/rocprofiler/test/tool/tool.cpp @@ -128,6 +128,7 @@ std::vector* kernel_string_vec = NULL; // DIspatch number range filter std::vector* range_vec = NULL; // Otstanding dispatches parameters +static uint32_t CTX_OUTSTANDING_WAIT = 1; static uint32_t CTX_OUTSTANDING_MAX = 0; static uint32_t CTX_OUTSTANDING_MON = 0; // to truncate kernel names @@ -801,6 +802,8 @@ extern "C" PUBLIC_API void OnLoadToolProp(rocprofiler_settings_t* settings) if (it != opts.end()) { to_truncate_names = (it->second == "on") ? 1 : 0; } it = opts.find("timestamp"); if (it != opts.end()) { settings->timestamp_on = (it->second == "on") ? 1 : 0; } + it = opts.find("ctx-wait"); + if (it != opts.end()) { CTX_OUTSTANDING_WAIT = atol(it->second.c_str()); } it = opts.find("ctx-limit"); if (it != opts.end()) { CTX_OUTSTANDING_MAX = atol(it->second.c_str()); } it = opts.find("heartbeat"); @@ -827,6 +830,7 @@ extern "C" PUBLIC_API void OnLoadToolProp(rocprofiler_settings_t* settings) // Enable kernel names truncating check_env_var("ROCP_TRUNCATE_NAMES", to_truncate_names); // Set outstanding dispatches parameter + check_env_var("ROCP_OUTSTANDING_WAIT", CTX_OUTSTANDING_WAIT); check_env_var("ROCP_OUTSTANDING_MAX", CTX_OUTSTANDING_MAX); check_env_var("ROCP_OUTSTANDING_MON", CTX_OUTSTANDING_MON); // Enable timestamping @@ -1062,13 +1066,13 @@ extern "C" PUBLIC_API void OnUnloadTool() { fflush(stdout); if (result_file_opened) { printf("\nROCPRofiler:"); fflush(stdout); - dump_context_array(NULL); + if (CTX_OUTSTANDING_WAIT == 1) dump_context_array(NULL); fclose(result_file_handle); printf(" %u contexts collected, output directory %s\n", context_collected, result_prefix); } else { if (context_collected != context_count) { results_output_break(); - dump_context_array(NULL); + if (CTX_OUTSTANDING_WAIT == 1) dump_context_array(NULL); } printf("\nROCPRofiler: %u contexts collected\n", context_collected); }