diff --git a/README.md b/README.md index 76895463c8..530aae1fe5 100644 --- a/README.md +++ b/README.md @@ -303,7 +303,12 @@ The user has two options for building: ```bash cd build && cmake --build . -- -j check ``` +## Logging +To enable error messages logging to '/tmp/rocprofiler_log.txt': + ```bash + $ export ROCPROFILER_LOG=1 + ``` ## Documentation We make use of doxygen to automatically generate API documentation. Generated document can be found in the following path: diff --git a/src/utils/logger.h b/src/utils/logger.h index b2d548831a..0bfe35d921 100644 --- a/src/utils/logger.h +++ b/src/utils/logger.h @@ -66,7 +66,7 @@ class Logger { static void endl() { Instance().ResetStreaming(false); } const std::string& LastMessage() { - std::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); return message_[GetTid()]; } @@ -94,7 +94,7 @@ class Logger { } void ResetStreaming(const bool messaging) { - std::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); if (messaging) { message_[GetTid()] = ""; } else if (streaming_) { @@ -106,7 +106,7 @@ class Logger { } void Put(const std::string& m) { - std::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); if (messaging_) { message_[GetTid()] += m; } diff --git a/tests-v2/featuretests/profiler/profiler_gtest.cpp b/tests-v2/featuretests/profiler/profiler_gtest.cpp index b229825d23..818e1e9b41 100644 --- a/tests-v2/featuretests/profiler/profiler_gtest.cpp +++ b/tests-v2/featuretests/profiler/profiler_gtest.cpp @@ -35,7 +35,7 @@ THE SOFTWARE. #include "src/utils/helper.h" #include "utils/test_utils.h" #include "utils/csv_parser.h" - +#include "src/utils/logger.h" std::string running_path; std::string lib_path; @@ -47,6 +47,7 @@ std::string profiler_api_lib_path = ""; static void init_test_path() { if (is_installed_path()) { + INFO_LOGGING("operating from /opt/rocm"); running_path = "share/rocprofiler/tests/runFeatureTests"; lib_path = "lib/rocprofiler/librocprofiler_tool.so"; golden_trace_path = "share/rocprofiler/tests/featuretests/profiler/apps/goldentraces/"; @@ -55,6 +56,7 @@ static void init_test_path() { binary_path = "bin/rocprofv2"; profiler_api_lib_path = "/lib"; } else { + INFO_LOGGING("operating from ./build/"); running_path = "tests-v2/featuretests/profiler/runFeatureTests"; lib_path = "librocprofiler_tool.so"; golden_trace_path = "tests-v2/featuretests/profiler/apps/goldentraces/";