Detect running timers, and stop a timer in ltl2tgba.

* src/misc/timer.hh (time_info::running): New attribute.
(time_info::start, time_info::stop): Update and check
time_info::running.
* src/misc/timer.cc (timer_map::print): Mark running timers with
a "+" in the output.
* src/tgbatest/ltl2tgba.cc (main): Rename the name of the timers
for SCC and simulation reduction, and actually stop the SCC timer.
This commit is contained in:
Alexandre Duret-Lutz 2009-11-24 11:47:42 +01:00
parent ab02ee60fe
commit b796bb3d0a
4 changed files with 37 additions and 10 deletions

View file

@ -1,4 +1,4 @@
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// Copyright (C) 2004, 2009 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
@ -53,6 +53,8 @@ namespace spot
void
start()
{
assert(!running);
running = true;
struct tms tmp;
times(&tmp);
start_.utime = tmp.tms_utime;
@ -67,6 +69,8 @@ namespace spot
times(&tmp);
total_.utime += tmp.tms_utime - start_.utime;
total_.stime += tmp.tms_stime - start_.stime;
assert(running);
running = false;
}
/// \brief Return the user time of all accumulated interval.
@ -89,9 +93,18 @@ namespace spot
return total_.stime;
}
/// \brief Whether the timer is running.
bool
is_running() const
{
return running;
}
protected:
time_info start_;
time_info total_;
bool running;
};
/// \brief A map of timer, where each timer has a name.