diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a615df3f1c7bf84cd69f91eed24cd50e622e70e..33a723fc2a039cfce7e4c02f741a9661bdb9d5f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ project(VITE CXX C) set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/") # Set c++11 support -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) diff --git a/src/parser/OTF2Parser/ParserDefinitionOTF2.cpp b/src/parser/OTF2Parser/ParserDefinitionOTF2.cpp index ab903250b63542bd1a5703095e25f904535e5fa9..5a6c3aefaeca542f2315cde98db329206f52ccfc 100644 --- a/src/parser/OTF2Parser/ParserDefinitionOTF2.cpp +++ b/src/parser/OTF2Parser/ParserDefinitionOTF2.cpp @@ -232,9 +232,12 @@ OTF2_CallbackCode ParserDefinitionOTF2::handler_DefLocation(void *userData, uint64_t numberOfEvents, OTF2_LocationGroupRef locationGroup) { OTF2_Reader *reader = (OTF2_Reader *)userData; + OTF2_Reader_SelectLocation(reader, locationIdentifier); + OTF2_EvtReader *evt_reader = OTF2_Reader_GetEvtReader(reader, locationIdentifier); OTF2_DefReader *def_reader = OTF2_Reader_GetDefReader(reader, locationIdentifier); uint64_t definitions_read = 0; + OTF2_Reader_ReadAllLocalDefinitions(reader, def_reader, &definitions_read); OTF2_Location *temp = new OTF2_Location(); @@ -537,6 +540,11 @@ Color *ParserDefinitionOTF2::get_color(uint32_t func_id) { return new Color(*_default_colors[func_id % NB_COLORS]); } + Color *ParserDefinitionOTF2::get_color(String function_name) { + uint32_t func_id = std::hash<std::string>{}(function_name.to_string()); + return get_color(func_id); +} + // // Other public functions // diff --git a/src/parser/OTF2Parser/ParserDefinitionOTF2.hpp b/src/parser/OTF2Parser/ParserDefinitionOTF2.hpp index c55887116655451877b7188f4b6b0e31e6d0ef59..dbfaa2da5e599d185c4c40edbe0f754efeefa6a8 100644 --- a/src/parser/OTF2Parser/ParserDefinitionOTF2.hpp +++ b/src/parser/OTF2Parser/ParserDefinitionOTF2.hpp @@ -454,6 +454,7 @@ public: static double get_timestamp(OTF2_TimeStamp ts); static Color *get_color(uint32_t func_id); + static Color *get_color(String function_name); static const char *get_string_by_id(uint32_t id); }; diff --git a/src/parser/OTF2Parser/ParserEventOTF2.cpp b/src/parser/OTF2Parser/ParserEventOTF2.cpp index b1164c8586021954737b05dd8386acf1dd299b26..1417b9f05e4b2937fb1229515631129d8eef7e9d 100644 --- a/src/parser/OTF2Parser/ParserEventOTF2.cpp +++ b/src/parser/OTF2Parser/ParserEventOTF2.cpp @@ -178,6 +178,84 @@ OTF2_CallbackCode ParserEventOTF2::callback_ProgramEnd(OTF2_LocationRef location return OTF2_CALLBACK_SUCCESS; } +static OTF2_CallbackCode pushState(OTF2_LocationRef locationID, + OTF2_TimeStamp time, + Trace *t, + String function_name) { + + Date d = ParserDefinitionOTF2::get_timestamp(time); + map<string, Value *> extra_fields; + + // get the container + OTF2_Location *temp_location = ParserDefinitionOTF2::get_location_by_id(locationID); + const String proc_name = String(ParserDefinitionOTF2::get_string_id(temp_location)); + Container *temp_container = temp_location->container; + +#if defined(OTF2_DEBUG) + cout << d.to_string() << " Enter_print(location=" << proc_name.to_string() << ", fname=" << function_name.to_string() << ")\n"; +#endif // defined(OTF2_DEBUG) + + // get the state type + String state_type_string("Function"); + StateType *temp_state_type = t->search_state_type(state_type_string); + if (temp_state_type == 0) { + Name name_temp(state_type_string); + ContainerType cont_type = *temp_container->get_type(); + t->define_state_type(name_temp, &cont_type, extra_fields); + temp_state_type = t->search_state_type(state_type_string); + assert(temp_state_type != 0); + } + + // get the entity value + EntityValue *temp_value = NULL; + temp_value = t->search_entity_value(function_name, temp_state_type); + if (temp_value == NULL) { + map<string, Value *> opt; + Name entity_name(function_name); + opt["Color"] = ParserDefinitionOTF2::get_color(function_name); + t->define_entity_value(entity_name, temp_state_type, opt); + temp_value = t->search_entity_value(function_name, temp_state_type); + } + assert(temp_value); + + t->push_state(d, temp_state_type, temp_container, temp_value, extra_fields); + + return OTF2_CALLBACK_SUCCESS; +} + + +static OTF2_CallbackCode popState(OTF2_LocationRef locationID, + OTF2_TimeStamp time, + Trace *t, + String function_name) { + Date d = ParserDefinitionOTF2::get_timestamp(time); + map<string, Value *> extra_fields; + + // get the container + OTF2_Location *temp_location = ParserDefinitionOTF2::get_location_by_id(locationID); + const String proc_name = String(ParserDefinitionOTF2::get_string_id(temp_location)); + Container *temp_container = temp_location->container; + +#if defined(OTF2_DEBUG) + cout << d.to_string() << " Leave_print(location=" << proc_name.to_string() << ", fname=" << function_name.to_string() << ")\n"; +#endif // defined(OTF2_DEBUG) + + // get the state type + String state_type_string("Function"); + StateType *temp_state_type = t->search_state_type(state_type_string); + if (temp_state_type == 0) { + Name name_temp(state_type_string); + ContainerType cont_type = *temp_container->get_type(); + t->define_state_type(name_temp, &cont_type, extra_fields); + temp_state_type = t->search_state_type(state_type_string); + assert(temp_state_type != 0); + } + + t->pop_state(d, temp_state_type, temp_container, extra_fields); + + return OTF2_CALLBACK_SUCCESS; +} + // // Start definition of handlers for OTF2 event records // @@ -188,6 +266,11 @@ OTF2_CallbackCode ParserEventOTF2::callback_Enter(OTF2_LocationRef locationID, OTF2_RegionRef regionID) { ENTER_CALLBACK(time, locationID); Trace *t = (Trace *)userData; + OTF2_Function temp_function = ParserDefinitionOTF2::get_function_by_id(regionID); + const String function_name = String(ParserDefinitionOTF2::get_string_by_id(temp_function._name_id)); + return pushState(locationID, time, t, function_name); + +#if 0 Date d = ParserDefinitionOTF2::get_timestamp(time); OTF2_Function temp_function = ParserDefinitionOTF2::get_function_by_id(regionID); const String function_name = String(ParserDefinitionOTF2::get_string_by_id(temp_function._name_id)); @@ -226,7 +309,7 @@ OTF2_CallbackCode ParserEventOTF2::callback_Enter(OTF2_LocationRef locationID, assert(temp_value); t->push_state(d, temp_state_type, temp_container, temp_value, extra_fields); - +#endif return OTF2_CALLBACK_SUCCESS; } @@ -1025,14 +1108,15 @@ OTF2_CallbackCode ParserEventOTF2::callback_ThreadCreate(OTF2_LocationRef locati OTF2_CallbackCode ParserEventOTF2::callback_ThreadBegin(OTF2_LocationRef locationID, OTF2_TimeStamp time, - void * /*userData*/, + void * userData, OTF2_AttributeList * /*attributeList*/, OTF2_CommRef /*threadContingent*/, uint64_t /*sequenceCount*/) { ENTER_CALLBACK(time, locationID); - // Nothing to do here - return OTF2_CALLBACK_SUCCESS; + Trace *t = (Trace *)userData; + const String function_name(""); + return pushState(locationID, time, t, function_name); } OTF2_CallbackCode ParserEventOTF2::callback_ThreadWait(OTF2_LocationRef locationID, @@ -1048,12 +1132,16 @@ OTF2_CallbackCode ParserEventOTF2::callback_ThreadWait(OTF2_LocationRef location OTF2_CallbackCode ParserEventOTF2::callback_ThreadEnd(OTF2_LocationRef locationID, OTF2_TimeStamp time, - void * /*userData*/, + void * userData, OTF2_AttributeList * /*attributeList*/, OTF2_CommRef /*threadContingent*/, uint64_t /*sequenceCount*/) { ENTER_CALLBACK(time, locationID); // Nothing to do here + Trace *t = (Trace *)userData; + const String function_name(""); + return popState(locationID, time, t, function_name); + return OTF2_CALLBACK_SUCCESS; } diff --git a/src/parser/ParserFactory.cpp b/src/parser/ParserFactory.cpp index b55167a414c7772553398dff361528fde76a93ff..30d5505b5268d72e9b39285a8328250348fc55c4 100644 --- a/src/parser/ParserFactory.cpp +++ b/src/parser/ParserFactory.cpp @@ -78,7 +78,7 @@ bool ParserFactory::create(Parser **parser, else if (ext == ".ept") { *parser = new ParserVite(filename); } - else if (ext == ".otf2") { + else if (ext == ".pallas") { #ifdef WITH_OTF2 *parser = new ParserOTF2(filename); #else