00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef VCSN_MISC_GLOBAL_TIMER_HH
00018 # define VCSN_MISC_GLOBAL_TIMER_HH
00019
00020
00021
00022
00023
00024 # ifdef GLOBAL_TIMER
00025 # ifdef VAUCANSON
00026 # include <vaucanson/misc/timer.hh>
00027 # define TIMER_SCOPED(Task)\
00028 vcsn::misc::ScopedTimer stimer (GLOBAL_TIMER, Task)
00029 # else
00030 # include "timer.hh"
00031 # define TIMER_SCOPED(Task) misc::ScopedTimer stimer (GLOBAL_TIMER, Task)
00032 # endif
00033 # define TIMER_START() GLOBAL_TIMER.start ()
00034 # define TIMER_PUSH(Task) GLOBAL_TIMER.push (Task)
00035 # define TIMER_POP(Task) GLOBAL_TIMER.pop (Task)
00036 # define TIMER_STOP() GLOBAL_TIMER.stop ()
00037 # define TIMER_DUMP(Stream) GLOBAL_TIMER.dump (Stream)
00038 # define TIMER_TASK(Task) GLOBAL_TIMER.task (Task)
00039 # define TIMER_PRINT(Stream) GLOBAL_TIMER.print (Stream)
00040 # define TIMER_PRINT_VD(Stream, Vd) GLOBAL_TIMER.print (Stream, Vd)
00041 # define TIMER_EXPORT_DOT(Stream) GLOBAL_TIMER.export_dot (Stream)
00042 # define TIMER_EXPORT_DOT_VD(Stream, Vd) GLOBAL_TIMER.export_dot (Stream, Vd)
00043 # define TIMER_EXPORT_DOT_VD_CR(Stream, Vd, Cr)\
00044 GLOBAL_TIMER.export_dot (Stream, Vd, Cr)
00045 # else
00046 # define TIMER_START() ((void) 0)
00047 # define TIMER_PUSH(Task) ((void) 0)
00048 # define TIMER_POP(Task) ((void) 0)
00049 # define TIMER_STOP() ((void) 0)
00050 # define TIMER_DUMP(Stream) ((void) 0)
00051 # define TIMER_TASK(Task) ((int) 0)
00052 # define TIMER_SCOPED(Task) ((void) 0)
00053 # define TIMER_PRINT(Stream) ((void) 0)
00054 # define TIMER_PRINT_VD(Stream, Vd) ((void) 0)
00055 # define TIMER_EXPORT_DOT(Stream) ((void) 0)
00056 # define TIMER_EXPORT_DOT_VD(Stream, Vd) ((void) 0)
00057 # define TIMER_EXPORT_DOT_VD_CR(Stream, Vd, Cr)((void) 0)
00058 # endif
00059
00060
00061
00062
00063
00064
00065 # ifdef GLOBAL_BENCHER
00066 # ifdef VAUCANSON
00067 # include <vaucanson/misc/bencher.hh>
00068 # else
00069 # include "bencher.hh"
00070 # endif
00071
00072 # define BENCH_DO(Iterations) \
00073 for (unsigned i_ = 1; i_ <= (Iterations); \
00074 ++i_, GLOBAL_BENCHER.push(GLOBAL_TIMER), (GLOBAL_TIMER).clear())
00075
00076 # define BENCH_PRINT(Stream) \
00077 Stream << GLOBAL_BENCHER << std::endl
00078
00079 # define BENCH_PLOT(Stream) \
00080 GLOBAL_BENCHER.plot (Stream)
00081
00082 # define BENCH_SAVE_PLOT(Filename) \
00083 do { \
00084 std::ofstream o (Filename, \
00085 std::ofstream::out | std::ofstream::trunc); \
00086 BENCH_PLOT(o); \
00087 o.close(); \
00088 } while (0)
00089
00090 # else
00091
00092 # define BENCH_DO(Iterations) ((void) 0)
00093 # define BENCH_PRINT(Stream) ((void) 0)
00094 # define BENCH_PLOT(Stream) ((void) 0)
00095 # define BENCH_SAVE_PLOT(Filename) ((void) 0)
00096
00097 # endif
00098
00099
00100 #endif // ! VCSN_MISC_GLOBAL_TIMER_HH