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,3 +1,15 @@
2009-11-24 Alexandre Duret-Lutz <adl@lrde.epita.fr>
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 <adl@lrde.epita.fr> 2009-11-23 Alexandre Duret-Lutz <adl@lrde.epita.fr>
* src/tgbaalgos/sccfilter.cc (create_transition): Do not clone * src/tgbaalgos/sccfilter.cc (create_transition): Do not clone

View file

@ -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 // département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie. // et Marie Curie.
// //
@ -56,20 +56,22 @@ namespace spot
name.erase(22); name.erase(22);
const spot::timer& t = i->second.first; 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(6) << t.utime() << " "
<< std::setw(8) << (total.utime ? << std::setw(8) << (total.utime ?
100.0 * t.utime() / total.utime : 0.) 100.0 * t.utime() / total.utime : 0.)
<< " |" << sep
<< std::setw(6) << t.stime() << " " << std::setw(6) << t.stime() << " "
<< std::setw(8) << (total.stime ? << std::setw(8) << (total.stime ?
100.0 * t.stime() / total.stime : 0.) 100.0 * t.stime() / total.stime : 0.)
<< " |" << sep
<< std::setw(6) << t.utime() + t.stime() << " " << std::setw(6) << t.utime() + t.stime() << " "
<< std::setw(8) << (grand_total ? << std::setw(8) << (grand_total ?
(100.0 * (t.utime() + t.stime()) / (100.0 * (t.utime() + t.stime()) /
grand_total) : 0.) grand_total) : 0.)
<< " |" << sep
<< std::setw(4) << i->second.second << std::setw(4) << i->second.second
<< std::endl; << std::endl;
} }

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

View file

@ -722,14 +722,14 @@ main(int argc, char** argv)
if (reduc_aut & spot::Reduce_Scc) 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); 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) 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); a = aut_red = new spot::tgba_reduc(a);
if (reduc_aut & (spot::Reduce_quotient_Dir_Sim | if (reduc_aut & (spot::Reduce_quotient_Dir_Sim |
@ -779,7 +779,7 @@ main(int argc, char** argv)
if (rel_del) if (rel_del)
spot::free_relation_simulation(rel_del); spot::free_relation_simulation(rel_del);
} }
tm.stop("reducing formula aut. w/ sim."); tm.stop("reducing A_f w/ sim.");
} }
} }