X-Git-Url: https://scm.cri.ensmp.fr/git/Faustine.git/blobdiff_plain/1059e1cc0c2ecfa237406949aa26155b6a5b9154..66f23d4fabf89ad09adbd4dfc15ac6b5b2b7da83:/interpreter/preprocessor/faust-0.9.47mr3/compiler/errors/timing.cpp diff --git a/interpreter/preprocessor/faust-0.9.47mr3/compiler/errors/timing.cpp b/interpreter/preprocessor/faust-0.9.47mr3/compiler/errors/timing.cpp new file mode 100644 index 0000000..ac35163 --- /dev/null +++ b/interpreter/preprocessor/faust-0.9.47mr3/compiler/errors/timing.cpp @@ -0,0 +1,55 @@ +#include +#include +#ifndef WIN32 +#include +#endif +#include "timing.hh" + +using namespace std; + + +#if 0 +double mysecond() +{ + struct timeval tp; + struct timezone tzp; + int i; + + i = gettimeofday(&tp,&tzp); + return ( (double) tp.tv_sec + (double) tp.tv_usec * 1.e-6 ); +} + +int lIndex=0; +double lStartTime[1024]; +double lEndTime[1024]; + +static void tab (int n, ostream& fout) +{ + fout << '\n'; + while (n--) fout << '\t'; +} + +void startTiming (const char* msg) +{ + assert(lIndex < 1023); + tab(lIndex, cerr); cerr << "start " << msg << endl; + lStartTime[lIndex++] = mysecond(); +} + +void endTiming (const char* msg) +{ + assert(lIndex>0); + lEndTime[--lIndex] = mysecond(); + tab(lIndex, cerr); cerr << "end " << msg << " (duration : " << lEndTime[lIndex] - lStartTime[lIndex] << ")" << endl; +} + +#else + +void startTiming (const char* msg) +{} + +void endTiming (const char* msg) +{} + +#endif +