From 5a619797fb56d329023e098e9a9800627728a22b Mon Sep 17 00:00:00 2001 From: Aleksandar Janicijevic Date: Wed, 12 Jun 2024 13:19:07 -0400 Subject: [PATCH 1/2] Changed macros verbprintf and verbprintf_bare so they write to stdout instead of stderr. --- source/bin/omnitrace-avail/common.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/bin/omnitrace-avail/common.hpp b/source/bin/omnitrace-avail/common.hpp index f448c7840..3e8e56563 100644 --- a/source/bin/omnitrace-avail/common.hpp +++ b/source/bin/omnitrace-avail/common.hpp @@ -181,18 +181,18 @@ file_exists(const std::string&); { \ if(debug_msg || verbose_level >= LEVEL) \ { \ - fprintf(stderr, "%s", tim::log::color::info()); \ - fprintf(stderr, "[omnitrace][avail] " __VA_ARGS__); \ - fprintf(stderr, "%s", tim::log::color::end()); \ + fprintf(stdout, "%s", tim::log::color::info()); \ + fprintf(stdout, "[omnitrace][avail] " __VA_ARGS__); \ + fprintf(stdout, "%s", tim::log::color::end()); \ } \ - fflush(stderr); \ + fflush(stdout); \ } #define verbprintf_bare(LEVEL, ...) \ { \ if(debug_msg || verbose_level >= LEVEL) \ { \ - fprintf(stderr, __VA_ARGS__); \ + fprintf(stdout, __VA_ARGS__); \ } \ - fflush(stderr); \ + fflush(stdout); \ } From acfcb4224ab39414f6d96e3dd395d6980943e14d Mon Sep 17 00:00:00 2001 From: Aleksandar Janicijevic Date: Fri, 14 Jun 2024 14:23:11 -0400 Subject: [PATCH 2/2] Modified after code review: write verbose output to stderr, flush stdout. --- source/bin/omnitrace-avail/avail.cpp | 6 +++--- source/bin/omnitrace-avail/common.hpp | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/source/bin/omnitrace-avail/avail.cpp b/source/bin/omnitrace-avail/avail.cpp index 53031f2f4..5fe5c446f 100644 --- a/source/bin/omnitrace-avail/avail.cpp +++ b/source/bin/omnitrace-avail/avail.cpp @@ -338,7 +338,7 @@ main(int argc, char** argv) << itr.description << "\n"; } } - std::cout << _msg.str(); + std::cout << _msg.str() << std::flush; } }); parser @@ -521,12 +521,12 @@ main(int argc, char** argv) { verbprintf(0, "Retrieving the GPU HW counters failed: %s", _e.what()); } - verbprintf(0, "Found %i HIP devices and %zu GPU HW counters\n", gpu_count, + verbprintf(1, "Found %i HIP devices and %zu GPU HW counters\n", gpu_count, _num_metrics); } else { - verbprintf(0, "No HIP devices found. GPU HW counters will not be available\n"); + verbprintf(1, "No HIP devices found. GPU HW counters will not be available\n"); } #endif diff --git a/source/bin/omnitrace-avail/common.hpp b/source/bin/omnitrace-avail/common.hpp index 3e8e56563..f448c7840 100644 --- a/source/bin/omnitrace-avail/common.hpp +++ b/source/bin/omnitrace-avail/common.hpp @@ -181,18 +181,18 @@ file_exists(const std::string&); { \ if(debug_msg || verbose_level >= LEVEL) \ { \ - fprintf(stdout, "%s", tim::log::color::info()); \ - fprintf(stdout, "[omnitrace][avail] " __VA_ARGS__); \ - fprintf(stdout, "%s", tim::log::color::end()); \ + fprintf(stderr, "%s", tim::log::color::info()); \ + fprintf(stderr, "[omnitrace][avail] " __VA_ARGS__); \ + fprintf(stderr, "%s", tim::log::color::end()); \ } \ - fflush(stdout); \ + fflush(stderr); \ } #define verbprintf_bare(LEVEL, ...) \ { \ if(debug_msg || verbose_level >= LEVEL) \ { \ - fprintf(stdout, __VA_ARGS__); \ + fprintf(stderr, __VA_ARGS__); \ } \ - fflush(stdout); \ + fflush(stderr); \ }