@@ -28,44 +28,51 @@ static compat::RegisterCodeDealloc register_dealloc(on_dealloc);
2828
2929// Used for regions, that have an identifier, aka a code object id. (instrumenter regions and
3030// some decorated regions)
31- void region_begin (std::string_view& function_name, std::string_view& module ,
32- const std::string& file_name, const std::uint64_t line_number,
33- compat::PyCodeObject* identifier)
31+ void region_begin (std::string_view function_name, std::string module , std::string file_name,
32+ const std::uint64_t line_number, compat::PyCodeObject* identifier)
3433{
3534 region_handle& region = regions[identifier];
3635
3736 if (region == uninitialised_region_handle)
3837 {
39- auto & region_name = make_region_name (module , function_name);
38+ auto region_name = make_region_name (std::move ( module ) , function_name);
4039 SCOREP_User_RegionInit (®ion.value , NULL , NULL , region_name.c_str (),
4140 SCOREP_USER_REGION_TYPE_FUNCTION, file_name.c_str (), line_number);
4241
43- SCOREP_User_RegionSetGroup (region.value , std::string (module , 0 , module .find (' .' )).c_str ());
42+ if (const auto pos = region_name.find (' :' ); pos != std::string::npos)
43+ {
44+ region_name.resize (pos);
45+ SCOREP_User_RegionSetGroup (region.value , region_name.c_str ());
46+ }
4447 }
4548 SCOREP_User_RegionEnter (region.value );
4649}
4750
4851// Used for regions, that only have a function name, a module, a file and a line number (user
4952// regions)
50- void region_begin (std::string_view& function_name, std::string_view& module ,
51- const std::string& file_name, const std:: uint64_t line_number)
53+ void region_begin (std::string_view function_name, std::string module , std::string file_name ,
54+ const std::uint64_t line_number)
5255{
53- std::string region_name = make_region_name (module , function_name);
56+ auto region_name = make_region_name (std::move ( module ) , function_name);
5457 region_handle& region = user_regions[region_name];
5558
5659 if (region == uninitialised_region_handle)
5760 {
5861 SCOREP_User_RegionInit (®ion.value , NULL , NULL , region_name.c_str (),
5962 SCOREP_USER_REGION_TYPE_FUNCTION, file_name.c_str (), line_number);
6063
61- SCOREP_User_RegionSetGroup (region.value , std::string (module , 0 , module .find (' .' )).c_str ());
64+ if (const auto pos = region_name.find (' :' ); pos != std::string::npos)
65+ {
66+ region_name.resize (pos);
67+ SCOREP_User_RegionSetGroup (region.value , region_name.c_str ());
68+ }
6269 }
6370 SCOREP_User_RegionEnter (region.value );
6471}
6572
6673// Used for regions, that have an identifier, aka a code object id. (instrumenter regions and
6774// some decorated regions)
68- void region_end (std::string_view& function_name, std::string_view& module ,
75+ void region_end (std::string_view function_name, std::string module ,
6976 compat::PyCodeObject* identifier)
7077{
7178 const auto it_region = regions.find (identifier);
@@ -75,27 +82,27 @@ void region_end(std::string_view& function_name, std::string_view& module,
7582 }
7683 else
7784 {
78- std::string region_name = make_region_name (module , function_name);
79- region_end_error_handling (region_name);
85+ const auto region_name = make_region_name (std::move ( module ) , function_name);
86+ region_end_error_handling (std::move ( region_name) );
8087 }
8188}
8289
8390// Used for regions, that only have a function name, a module (user regions)
84- void region_end (std::string_view& function_name, std::string_view& module )
91+ void region_end (std::string_view function_name, std::string module )
8592{
86- std::string region_name = make_region_name (module , function_name);
93+ const auto region_name = make_region_name (std::move ( module ) , function_name);
8794 auto it_region = user_regions.find (region_name);
8895 if (it_region != user_regions.end ())
8996 {
9097 SCOREP_User_RegionEnd (it_region->second .value );
9198 }
9299 else
93100 {
94- region_end_error_handling (region_name);
101+ region_end_error_handling (std::move ( region_name) );
95102 }
96103}
97104
98- void region_end_error_handling (const std::string& region_name)
105+ void region_end_error_handling (std::string region_name)
99106{
100107 static region_handle error_region;
101108 static SCOREP_User_ParameterHandle scorep_param = SCOREP_USER_INVALID_PARAMETER;
0 commit comments