diff --git a/ChangeLog b/ChangeLog index 0ca000c5b..b0b1f8ee0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2009-11-24 Alexandre Duret-Lutz + + 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. + 2009-11-23 Alexandre Duret-Lutz * src/tgbaalgos/sccfilter.cc (create_transition): Do not clone diff --git a/src/misc/timer.cc b/src/misc/timer.cc index 719f0b3a0..21142299c 100644 --- a/src/misc/timer.cc +++ b/src/misc/timer.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6), +// Copyright (C) 2004, 2005, 2009 Laboratoire d'Informatique de Paris 6 (LIP6), // département Systèmes Répartis Coopératifs (SRC), Université Pierre // et Marie Curie. // @@ -56,20 +56,22 @@ namespace spot name.erase(22); const spot::timer& t = i->second.first; - os << std::setw(22) << name << " |" + const char* sep = t.is_running() ? "+|" : " |"; + + os << std::setw(22) << name << sep << std::setw(6) << t.utime() << " " << std::setw(8) << (total.utime ? 100.0 * t.utime() / total.utime : 0.) - << " |" + << sep << std::setw(6) << t.stime() << " " << std::setw(8) << (total.stime ? 100.0 * t.stime() / total.stime : 0.) - << " |" + << sep << std::setw(6) << t.utime() + t.stime() << " " << std::setw(8) << (grand_total ? (100.0 * (t.utime() + t.stime()) / grand_total) : 0.) - << " |" + << sep << std::setw(4) << i->second.second << std::endl; } diff --git a/src/misc/timer.hh b/src/misc/timer.hh index 974fbd19d..96b8ed13a 100644 --- a/src/misc/timer.hh +++ b/src/misc/timer.hh @@ -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. diff --git a/src/tgbatest/ltl2tgba.cc b/src/tgbatest/ltl2tgba.cc index 7b7501898..d7c5340df 100644 --- a/src/tgbatest/ltl2tgba.cc +++ b/src/tgbatest/ltl2tgba.cc @@ -722,14 +722,14 @@ main(int argc, char** argv) if (reduc_aut & spot::Reduce_Scc) { - tm.start("reducing formula aut. w/ SCC"); + tm.start("reducing A_f w/ SCC"); a = aut_scc = spot::scc_filter(a); - tm.start("reducing formula aut. w/ SCC"); + tm.start("reducing A_f w/ SCC"); } if (reduc_aut & !spot::Reduce_Scc) { - tm.start("reducing formula aut. w/ sim."); + tm.start("reducing A_f w/ sim."); a = aut_red = new spot::tgba_reduc(a); if (reduc_aut & (spot::Reduce_quotient_Dir_Sim | @@ -779,7 +779,7 @@ main(int argc, char** argv) if (rel_del) spot::free_relation_simulation(rel_del); } - tm.stop("reducing formula aut. w/ sim."); + tm.stop("reducing A_f w/ sim."); } }