Commit fefb8080 authored by BRAMAS Berenger's avatar BRAMAS Berenger

add the code to process the timer output

parent 7d73184d
......@@ -17,7 +17,10 @@
#define FTIME_TASKS(X)
#endif
/**
* @brief The FTaskTimer class
* you can find at the bottom of the file a way of loading a file generated by FTaskTimer
*/
class FTaskTimer{
protected:
static const int MaxTextLength = 16;
......@@ -143,6 +146,51 @@ public:
};
/*
#include <cstdio>
#include <cassert>
static const int MaxTextLength = 16;
struct EventDescriptor{
char text[MaxTextLength];
double duration;
double start;
long long int eventId;
};
int main(int argc, char** argv){
assert(argc == 2);
FILE* ftime = fopen(argv[1], "r");
assert(ftime);
fscanf(ftime,"%*[^\n]\n");
double duration;
int nbThreads;
long long int nbEvents;
// written by "global{@duration=%e;@max threads=%d;@nb events=%lld}\n"
assert(fscanf(ftime,"global{@duration=%lf;@max threads=%d;@nb events=%lld}\n",
&duration,&nbThreads,&nbEvents) == 3);
printf("global{@duration=%e;@max threads=%d;@nb events=%lld}\n",
duration,nbThreads,nbEvents);
EventDescriptor* events = new EventDescriptor[nbEvents];
for(int idxEvent = 0 ; idxEvent < nbEvents ; ++idxEvent){
char line[1024];
fgets(line, 1024, ftime);
// written format "event{@id=%lld;@duration=%e;@start=%e;@text=%s}\n"
assert(sscanf(line,"event{@id=%lld;@duration=%lf;@start=%lf;@text=%[^}]s%*[^\n]\n",
&events[idxEvent].eventId,&events[idxEvent].duration,&events[idxEvent].start,events[idxEvent].text) == 4);
printf("event{@id=%lld;@duration=%lf;@start=%lf;@text=%s}\n",
events[idxEvent].eventId, events[idxEvent].duration, events[idxEvent].start, events[idxEvent].text);
}
fclose(ftime);
return 0;
}
*/
#endif // FTASKTIMER_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