00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 #ifndef VCSN_MISC_GLOBAL_BENCHER_HH
00018 # define VCSN_MISC_GLOBAL_BENCHER_HH
00019 
00020 
00021 
00022 
00023 
00024 # ifdef GLOBAL_BENCHER
00025 
00026 #  include <cbs/bench/bench.hh>
00027 #  include <cbs/bench/bench_internals.hh>
00028 
00029 #  ifdef VAUCANSON
00030 #   include <vaucanson/misc/bencher.hh>
00031 #  else
00032 #   include "bencher.hh"
00033 #  endif
00034 
00035 #  define BENCHER_DO(Iterations)                                        \
00036   for (unsigned i_ = 1; i_ <= (Iterations);                             \
00037        ++i_, GLOBAL_BENCHER.push(bench::current_timer()), bench::restart())
00038 
00039 # define BENCHER_PRINT(Stream)                          \
00040   Stream << GLOBAL_BENCHER << std::endl
00041 
00042 # define BENCHER_PLOT(Stream)                           \
00043   GLOBAL_BENCHER.plot (Stream)
00044 
00045 # define BENCHER_SAVE_PLOT(Filename)                                    \
00046   do {                                                                  \
00047     std::ofstream o (Filename,                                          \
00048                      std::ofstream::out | std::ofstream::trunc);        \
00049     BENCHER_PLOT(o);                                                    \
00050     o.close();                                                          \
00051   } while (0)
00052 
00053 # else
00054 
00055 # define BENCHER_DO(Iterations)         ((void) 0)
00056 # define BENCHER_PRINT(Stream)          ((void) 0)
00057 # define BENCHER_PLOT(Stream)           ((void) 0)
00058 # define BENCHER_SAVE_PLOT(Filename)    ((void) 0)
00059 
00060 # endif
00061 
00062 
00063 #endif // ! VCSN_MISC_GLOBAL_BENCHER_HH