Skip to content

Commit

Permalink
Split on : to deduce function group name
Browse files Browse the repository at this point in the history
  • Loading branch information
bertwesarg committed Nov 20, 2023
1 parent 391e01e commit fdfe8e0
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/scorepy/events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(&region.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);
}
Expand All @@ -50,15 +54,19 @@ 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)
{
SCOREP_User_RegionInit(&region.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);
}
Expand Down

0 comments on commit fdfe8e0

Please sign in to comment.