@@ -26,7 +26,7 @@ constexpr region_handle uninitialised_region_handle = region_handle();
2626static std::unordered_map<std::string, region_handle> regions;
2727static std::unordered_map<std::string, region_handle> rewind_regions;
2828
29- void region_begin (const std::string& region_name, std::string module , std::string file_name,
29+ void region_begin (const std::string& region_name, const CString& module , const CString& file_name,
3030 std::uint64_t line_number)
3131{
3232 auto & region_handle = regions[region_name];
@@ -36,8 +36,17 @@ void region_begin(const std::string& region_name, std::string module, std::strin
3636 SCOREP_User_RegionInit (®ion_handle.value , NULL , &SCOREP_User_LastFileHandle,
3737 region_name.c_str (), SCOREP_USER_REGION_TYPE_FUNCTION,
3838 file_name.c_str (), line_number);
39- SCOREP_User_RegionSetGroup (region_handle.value ,
40- std::string (module , 0 , module .find (' .' )).c_str ());
39+ // Extract main module name if module is like "mainmodule.submodule.subsubmodule"
40+ const char * dot_pos = module .find (' .' );
41+ if (dot_pos)
42+ {
43+ const std::string main_module (module .c_str (), dot_pos);
44+ SCOREP_User_RegionSetGroup (region_handle.value , main_module.c_str ());
45+ }
46+ else
47+ {
48+ SCOREP_User_RegionSetGroup (region_handle.value , module .c_str ());
49+ }
4150 }
4251 SCOREP_User_RegionEnter (region_handle.value );
4352}
0 commit comments