00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 #ifndef BENCHER_HH
00022 # define BENCHER_HH
00023 
00024 
00025 # include <vector>
00026 # include <iostream>
00027 
00028 
00029 # include <cbs/bench/timer.hh>
00030 
00031 
00032 # ifdef VAUCANSON
00033 #  define NAMESPACE_VCSN_BEGIN namespace vcsn {
00034 #  define NAMESPACE_VCSN_END   } // namespace vcsn
00035 #  include <vaucanson/misc/contract.hh>
00036 # else
00037 #  define NAMESPACE_VCSN_BEGIN
00038 #  define NAMESPACE_VCSN_END
00039 #  include <cassert>
00040 #  define precondition(C) assert(C)
00041 # endif
00042 
00043 NAMESPACE_VCSN_BEGIN
00044 
00045 namespace misc
00046 {
00047   class Bencher
00048   {
00049   public:
00051     void push (const timer::Timer& t);
00052 
00054     std::ostream& print (std::ostream& o) const;
00055 
00056     void plot (std::ostream& o) const;
00057 
00059     timer::Timer sum() const;
00060 
00062     timer::Timer mean() const;
00063 
00065     timer::Timer min() const;
00066 
00068     timer::Timer max() const;
00069 
00070   private:
00072     timer::Timer prepare (timer::Timer t) const;
00073 
00075     std::vector<timer::Timer> timers_;
00076   };
00077 
00078 
00080   std::ostream& operator<< (std::ostream& o, const Bencher& t);
00081 }
00082 
00083 NAMESPACE_VCSN_END
00084 
00085 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00086 #  include <vaucanson/misc/bencher.hxx>
00087 #  if VAUCANSON
00088 #   include <vaucanson/misc/bencher.cc>
00089 #  endif
00090 # endif // VCSN_USE_INTERFACE_ONLY
00091 
00092 #endif // !BENCHER_HH