diff --git a/src/core/roctracer.cpp b/src/core/roctracer.cpp index b2c1c662c5..5bac30949f 100644 --- a/src/core/roctracer.cpp +++ b/src/core/roctracer.cpp @@ -1000,53 +1000,53 @@ PUBLIC_API roctracer_status_t roctracer_set_properties( // HSA-runtime tool on-load method PUBLIC_API bool roctracer_load(HsaApiTable* table, uint64_t runtime_version, uint64_t failed_tool_count, const char* const* failed_tool_names) { - if (onload_debug) printf("LIB roctracer_load\n"); fflush(stdout); + if (onload_debug) { printf("LIB roctracer_load\n"); fflush(stdout); } static bool is_loaded = false; if (is_loaded) return true; is_loaded = true; - if (onload_debug) printf("LIB roctracer_load end\n"); fflush(stdout); + if (onload_debug) { printf("LIB roctracer_load end\n"); fflush(stdout); } return true; } PUBLIC_API void roctracer_unload(bool destruct) { static bool is_unloaded = false; - if (onload_debug) printf("LIB roctracer_unload (%d, %d)\n", (int)destruct, (int)is_unloaded); fflush(stdout); + if (onload_debug) { printf("LIB roctracer_unload (%d, %d)\n", (int)destruct, (int)is_unloaded); fflush(stdout); } if (destruct == false) return; if (is_unloaded == true) return; is_unloaded = true; roctracer::trace_buffer.Flush(); roctracer::close_output_file(roctracer::kernel_file_handle); - if (onload_debug) printf("LIB roctracer_unload end\n"); fflush(stdout); + if (onload_debug) { printf("LIB roctracer_unload end\n"); fflush(stdout); } } PUBLIC_API bool OnLoad(HsaApiTable* table, uint64_t runtime_version, uint64_t failed_tool_count, const char* const* failed_tool_names) { - if (onload_debug) printf("LIB OnLoad\n"); fflush(stdout); + if (onload_debug) { printf("LIB OnLoad\n"); fflush(stdout); } const bool ret = roctracer_load(table, runtime_version, failed_tool_count, failed_tool_names); - if (onload_debug) printf("LIB OnLoad end\n"); fflush(stdout); + if (onload_debug) { printf("LIB OnLoad end\n"); fflush(stdout); } return ret; } PUBLIC_API void OnUnload() { - if (onload_debug) printf("LIB OnUnload\n"); fflush(stdout); + if (onload_debug) { printf("LIB OnUnload\n"); fflush(stdout); } roctracer_unload(false); - if (onload_debug) printf("LIB OnUnload end\n"); fflush(stdout); + if (onload_debug) { printf("LIB OnUnload end\n"); fflush(stdout); } } CONSTRUCTOR_API void constructor() { - if (onload_debug) printf("LIB constructor\n"); fflush(stdout); + if (onload_debug) { printf("LIB constructor\n"); fflush(stdout); } roctracer::util::Logger::Create(); - if (onload_debug) printf("LIB constructor end\n"); fflush(stdout); + if (onload_debug) { printf("LIB constructor end\n"); fflush(stdout); } } DESTRUCTOR_API void destructor() { - if (onload_debug) printf("LIB destructor\n"); fflush(stdout); + if (onload_debug) { printf("LIB destructor\n"); fflush(stdout); } roctracer_unload(true); util::HsaRsrcFactory::Destroy(); roctracer::util::Logger::Destroy(); - if (onload_debug) printf("LIB destructor end\n"); fflush(stdout); + if (onload_debug) { printf("LIB destructor end\n"); fflush(stdout); } } } // extern "C" diff --git a/test/tool/tracer_tool.cpp b/test/tool/tracer_tool.cpp index 6be899e520..af48e6ebd9 100644 --- a/test/tool/tracer_tool.cpp +++ b/test/tool/tracer_tool.cpp @@ -375,7 +375,7 @@ void close_output_file(FILE* file_handle) { // HSA-runtime tool on-load method extern "C" PUBLIC_API bool OnLoad(HsaApiTable* table, uint64_t runtime_version, uint64_t failed_tool_count, const char* const* failed_tool_names) { - if (onload_debug) printf("TOOL OnLoad\n"); fflush(stdout); + if (onload_debug) { printf("TOOL OnLoad\n"); fflush(stdout); } timer = new hsa_rt_utils::Timer(table->core_->hsa_system_get_info_fn); // API traces switches @@ -506,7 +506,7 @@ extern "C" PUBLIC_API bool OnLoad(HsaApiTable* table, uint64_t runtime_version, roctracer_set_properties(ACTIVITY_DOMAIN_HIP_API, (void*)mark_api_callback); } - if (onload_debug) printf("TOOL OnLoad end\n"); fflush(stdout); + if (onload_debug) { printf("TOOL OnLoad end\n"); fflush(stdout); } return roctracer_load(table, runtime_version, failed_tool_count, failed_tool_names); } @@ -514,7 +514,7 @@ extern "C" PUBLIC_API bool OnLoad(HsaApiTable* table, uint64_t runtime_version, void tool_unload(bool destruct) { static bool is_unloaded = false; - if (onload_debug) printf("TOOL tool_unload (%d, %d)\n", (int)destruct, (int)is_unloaded); fflush(stdout); + if (onload_debug) { printf("TOOL tool_unload (%d, %d)\n", (int)destruct, (int)is_unloaded); fflush(stdout); } if (destruct == false) return; if (is_unloaded == true) return; is_unloaded = true; @@ -542,21 +542,21 @@ void tool_unload(bool destruct) { close_output_file(hip_api_file_handle); close_output_file(hcc_activity_file_handle); } - if (onload_debug) printf("TOOL tool_unload end\n"); fflush(stdout); + if (onload_debug) { printf("TOOL tool_unload end\n"); fflush(stdout); } } // HSA-runtime on-unload method extern "C" PUBLIC_API void OnUnload() { - if (onload_debug) printf("TOOL OnUnload\n"); fflush(stdout); + if (onload_debug) { printf("TOOL OnUnload\n"); fflush(stdout); } tool_unload(false); - if (onload_debug) printf("TOOL OnUnload end\n"); fflush(stdout); + if (onload_debug) { printf("TOOL OnUnload end\n"); fflush(stdout); } } extern "C" CONSTRUCTOR_API void constructor() { - if (onload_debug) printf("TOOL constructor ...end\n"); fflush(stdout); + if (onload_debug) { printf("TOOL constructor ...end\n"); fflush(stdout); } } extern "C" DESTRUCTOR_API void destructor() { - if (onload_debug) printf("TOOL destructor\n"); fflush(stdout); + if (onload_debug) { printf("TOOL destructor\n"); fflush(stdout); } tool_unload(true); - if (onload_debug) printf("TOOL destructor end\n"); fflush(stdout); + if (onload_debug) { printf("TOOL destructor end\n"); fflush(stdout); } }