Mentions légales du service

Skip to content
Snippets Groups Projects
Commit fefb8080 authored by BRAMAS Berenger's avatar BRAMAS Berenger
Browse files

add the code to process the timer output

parent 7d73184d
No related branches found
No related tags found
No related merge requests found
...@@ -17,7 +17,10 @@ ...@@ -17,7 +17,10 @@
#define FTIME_TASKS(X) #define FTIME_TASKS(X)
#endif #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{ class FTaskTimer{
protected: protected:
static const int MaxTextLength = 16; static const int MaxTextLength = 16;
...@@ -143,6 +146,51 @@ public: ...@@ -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 #endif // FTASKTIMER_HPP
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment