From fdfe8e0095409710d371b4aef03f18bdbe6aeb54 Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Mon, 20 Nov 2023 17:57:05 +0100 Subject: [PATCH] Split on `:` to deduce function group name --- src/scorepy/events.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/scorepy/events.cpp b/src/scorepy/events.cpp index 686a25b..4d0b919 100644 --- a/src/scorepy/events.cpp +++ b/src/scorepy/events.cpp @@ -36,11 +36,15 @@ void region_begin(std::string_view function_name, std::string module, if (region == uninitialised_region_handle) { - const auto region_name = make_region_name(std::move(module), function_name); + auto region_name = make_region_name(std::move(module), function_name); SCOREP_User_RegionInit(®ion.value, NULL, NULL, region_name.c_str(), SCOREP_USER_REGION_TYPE_FUNCTION, file_name.c_str(), line_number); - SCOREP_User_RegionSetGroup(region.value, std::string(region_name, 0, region_name.find('.')).c_str()); + if ( const auto pos = region_name.find(':'); + pos != std::string::npos) { + region_name.resize(pos); + SCOREP_User_RegionSetGroup(region.value, region_name.c_str()); + } } SCOREP_User_RegionEnter(region.value); } @@ -50,7 +54,7 @@ void region_begin(std::string_view function_name, std::string module, void region_begin(std::string_view function_name, std::string module, std::string file_name, const std::uint64_t line_number) { - const auto region_name = make_region_name(std::move(module), function_name); + auto region_name = make_region_name(std::move(module), function_name); region_handle& region = user_regions[region_name]; if (region == uninitialised_region_handle) @@ -58,7 +62,11 @@ void region_begin(std::string_view function_name, std::string module, SCOREP_User_RegionInit(®ion.value, NULL, NULL, region_name.c_str(), SCOREP_USER_REGION_TYPE_FUNCTION, file_name.c_str(), line_number); - SCOREP_User_RegionSetGroup(region.value, std::string(region_name, 0, region_name.find('.')).c_str()); + if ( const auto pos = region_name.find(':'); + pos != std::string::npos) { + region_name.resize(pos); + SCOREP_User_RegionSetGroup(region.value, region_name.c_str()); + } } SCOREP_User_RegionEnter(region.value); }