00001
00002
00003
00004
00005
00006
00007
00008
00009
00014
00015 #ifndef OCTANE_SCOPE_TIMER_HPP_INCLUDED
00016 #define OCTANE_SCOPE_TIMER_HPP_INCLUDED
00017
00018 #include <iostream>
00019 #include <string>
00020
00021 #include "timer.hpp"
00022
00027 class OctaneScopeTimer {
00028
00029 public:
00034 OctaneScopeTimer(const std::string _pre="<scope_timer> ",
00035 const std::string _post=" seconds\n",
00036 std::ostream &_to=std::cout)
00037 : pre(_pre), post(_post), to(_to)
00038 { ; }
00039
00042 float get_elapsed() { return t.stop(); }
00043
00046 ~OctaneScopeTimer() { to << pre << t.stop() << post; }
00047
00048 private:
00049 const std::string pre, post;
00050 std::ostream &to;
00051 OctaneTimer t;
00052 };
00053
00054 #endif // OCTANE_SCOPE_TIMER_HPP_INCLUDED