From 5ab5d37fb9fda1b8a4b9aa3bb259c256033498b6 Mon Sep 17 00:00:00 2001 From: gobhardw Date: Sat, 22 Apr 2023 00:23:31 +0530 Subject: [PATCH] Ignoring commented lines in input for profiling Change-Id: I31c089024473f0b22e26d54d6db7e5818a064a0d [ROCm/rocprofiler commit: 591e3d734b36d6b76255a01d5a4268a67717885a] --- projects/rocprofiler/src/tools/tool.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/rocprofiler/src/tools/tool.cpp b/projects/rocprofiler/src/tools/tool.cpp index 395ce7432c..3a53a05918 100644 --- a/projects/rocprofiler/src/tools/tool.cpp +++ b/projects/rocprofiler/src/tools/tool.cpp @@ -152,6 +152,11 @@ std::vector GetCounterNames() { const char* line_c_str = getenv("ROCPROFILER_COUNTERS"); if (line_c_str) { std::string line = line_c_str; + //skip commented lines + auto found = line.find_first_not_of(" \t"); + if (found != std::string::npos) { + if (line[found] == '#') return {}; + } if (line.find("pmc") == std::string::npos) return counters; char seperator = ' '; std::string::size_type prev_pos = 0, pos = line.find(seperator, prev_pos);