Commit 014fddd1 authored by Johnny Jazeix's avatar Johnny Jazeix

fix build with VITE_ENABLE_TAU=ON and add default colors for TAU traces

parent c22ab003
......@@ -68,13 +68,54 @@ map <int, Tau::State> ParserTau::_states;
map <int, Tau::StateGroup> ParserTau::_states_groups;
map <int, Tau::Event> ParserTau::_events;
ParserTau::ParserTau() {};
ParserTau::ParserTau(const std::string &filename) : Parser(filename) {};
ParserTau::~ParserTau() {};
vector<Color *> ParserTau::_default_colors;
ParserTau::ParserTau() {
// Create the colors
_default_colors.push_back(new Color(1, 0, 0)); // Red
_default_colors.push_back(new Color(0, 1, 0)); // Green
_default_colors.push_back(new Color(0, 0, 1)); // Blue
_default_colors.push_back(new Color(1, 1, 0)); // Yellow
_default_colors.push_back(new Color(0, 1, 1)); // Cyan
_default_colors.push_back(new Color(1, 0, 1)); // Magenta
_default_colors.push_back(new Color(1, 0.5, 0)); // Orange
_default_colors.push_back(new Color(0.5, 0, 0.5)); // Purple
_default_colors.push_back(new Color(1, 0, 0.5)); // Orange
_default_colors.push_back(new Color(0, 0.5, 1)); // Clear blue
}
ParserTau::ParserTau(const std::string &filename) : Parser(filename) {
// Create the colors
_default_colors.push_back(new Color(1, 0, 0)); // Red
_default_colors.push_back(new Color(0, 1, 0)); // Green
_default_colors.push_back(new Color(0, 0, 1)); // Blue
_default_colors.push_back(new Color(1, 1, 0)); // Yellow
_default_colors.push_back(new Color(0, 1, 1)); // Cyan
_default_colors.push_back(new Color(1, 0, 1)); // Magenta
_default_colors.push_back(new Color(1, 0.5, 0)); // Orange
_default_colors.push_back(new Color(0.5, 0, 0.5)); // Purple
_default_colors.push_back(new Color(1, 0, 0.5)); // Orange
_default_colors.push_back(new Color(0, 0.5, 1)); // Clear blue
}
ParserTau::~ParserTau() {
// Free the memory used by the colors
const size_t nb_colors = _default_colors.size();
for(int i = 0 ; i < nb_colors ; ++ i) {
delete _default_colors[i];
_default_colors[i] = NULL;
}
_default_colors.clear();
}
void ParserTau::parse(Trace &trace, bool finish_trace_after_parse) {
const string base_name = _file_to_parse.substr(0, _file_to_parse.find_last_of('.'));
const std::string filename = get_next_file_to_parse();
if(filename == "")
return;
const string base_name = filename.substr(0, filename.find_last_of('.'));
const string file_trc = base_name + ".trc";
const string file_edf = base_name + ".edf";
......@@ -213,6 +254,7 @@ int ParserTau::enter_state (void *trace, double time, unsigned int nodeid, unsig
current_state._is_created = true;
Name name_temp(current_state._name);
map<string, Value *> opt;
opt["Color"] = get_color(stateid);
t->define_entity_value(name_temp, t->search_entity_type(state_group_name), opt);
}
......@@ -281,7 +323,7 @@ int ParserTau::event_triggered(void *trace, double time, unsigned int nodeToken,
}
t->new_event(d, event_type, current_container, value, opt);
t->new_event(d, event_type, current_container, opt);
//printf("EventTrigger: time %g, nid %d tid %d event id %d triggered value %lld \n", time, nodeToken, threadToken, userEventToken, userEventValue);
return 0;
......@@ -412,3 +454,7 @@ float ParserTau::get_percent_loaded() const {
//return ParserEvent::get_size_loaded();
return 0;
}
Color *ParserTau::get_color(int func_id) {
return new Color(*_default_colors[func_id % _default_colors.size()]);
}
......@@ -69,6 +69,12 @@ private:
static double _clock_period;
/*!
* Table containing default colors.
* We take the state id modulo the max number to get the color.
*/
static std::vector<Color *> _default_colors;
/*!
* \fn static int set_timer_resolution(void *trace, double clkPeriod)
* \brief Callback method to set the timer resolution
......@@ -224,6 +230,7 @@ public:
*/
float get_percent_loaded() const;
static Color *get_color(int func_id);
};
#endif // PARSERTAU_HPP
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment