23 #ifndef SPOT_MISC_TIMER_HH
24 # define SPOT_MISC_TIMER_HH
27 # include "misc/_config.h"
32 # if SPOT_HAVE_SYS_TIMES_H
33 # include <sys/times.h>
69 #ifdef SPOT_HAVE_TIMES
72 start_.utime = tmp.tms_utime + tmp.tms_cutime;
73 start_.stime = tmp.tms_stime + tmp.tms_cstime;
75 start_.utime = clock();
83 #ifdef SPOT_HAVE_TIMES
86 total_.utime += tmp.tms_utime + tmp.tms_cutime - start_.utime;
87 total_.stime += tmp.tms_stime + tmp.tms_cstime - start_.stime;
89 total_.utime += clock() - start_.utime;
145 item_type& it = tm[name];
156 tm[name].first.stop();
169 tm_type::iterator i = tm.find(name);
170 assert(i != tm.end());
171 assert(0 < i->second.second);
172 if (0 == --i->second.second)
178 timer(
const std::string& name)
const
180 tm_type::const_iterator i = tm.find(name);
181 assert(i != tm.end());
182 return i->second.first;
189 return tm[name].first;
204 SPOT_API std::ostream&
205 print(std::ostream& os)
const;
215 typedef std::pair<spot::timer, int> item_type;
216 typedef std::map<std::string, item_type> tm_type;
223 #endif // SPOT_MISC_TIMER_HH