spot: Add %R, %[..]R common option.

For #189.

* NEWS: Update.
* bin/autfilt.cc: Replace stopwatch with process_timer.
* bin/dstar2tgba.cc: Replace stopwatch with process_timer.
* bin/ltl2tgba.cc: Replace stopwatch with process_timer.
* bin/ltlcross.cc: Replace stopwatch with process_timer.
* bin/ltldo.cc: Replace stopwatch with process_timer.
* bin/randaut.cc: Replace stopwatch with process_timer.
* bin/common_aoutput.hh: Implement process_timer, integrate it.
* bin/common_aoutput.cc: Integrate process_timer and implement new
print method.
* spot/misc/timer.hh: Modify timer class and timeinfo struct
i.e. add cutime (children_utime) and cstime (children_stime).
* spot/misc/timer.cc: Help code to behave as before all this.
* spot/twaalgos/dtbasat.cc: Help print_log to behave as before
all this.
* spot/twaalgos/dtwasat.cc: Help print_log to behave as before
all this.
* spot/misc/formater.hh: Add operator<< for spot::timer.
This commit is contained in:
Alexandre GBAGUIDI AISSE 2016-10-24 17:46:26 +02:00 committed by Alexandre Duret-Lutz
parent 3eafbc823c
commit 6ed380709d
14 changed files with 277 additions and 79 deletions

View file

@ -27,6 +27,15 @@
namespace spot
{
/*
std::ostream& operator<<(std::ostream& os, const timer& dt)
{
os << "utime<" << dt.utime() << ">, cutime<" << dt.cutime()
<< ">, stime<" << dt.stime() << ">, cstime<" << dt.cstime() << '>';
return os;
}
*/
std::ostream&
timer_map::print(std::ostream& os) const
@ -39,8 +48,11 @@ namespace spot
{
total.utime += i->second.first.utime();
total.stime += i->second.first.stime();
total.cutime += i->second.first.cutime();
total.cstime += i->second.first.cstime();
}
clock_t grand_total = total.utime + total.stime;
clock_t grand_total = total.utime + total.cutime
+ total.stime + total.cstime;
os << std::setw(23) << ""
<< "| user time | sys. time | total |"
@ -61,18 +73,21 @@ namespace spot
const char* sep = t.is_running() ? "+|" : " |";
os << std::setw(22) << name << sep
<< std::setw(6) << t.utime() << ' '
<< std::setw(6) << t.utime() + t.cutime() << ' '
<< std::setw(8) << (total.utime ?
100.0 * t.utime() / total.utime : 0.)
100.0 * (t.utime() + t.cutime())
/ (total.utime + total.cutime) : 0.)
<< sep
<< std::setw(6) << t.stime() << ' '
<< std::setw(6) << t.stime() + t.cstime() << ' '
<< std::setw(8) << (total.stime ?
100.0 * t.stime() / total.stime : 0.)
100.0 * (t.stime() +t.cstime())
/ (total.stime + total.cstime) : 0.)
<< sep
<< std::setw(6) << t.utime() + t.stime() << ' '
<< std::setw(6) << t.utime() + t.cutime() + t.stime()
+ t.cstime() << ' '
<< std::setw(8) << (grand_total ?
(100.0 * (t.utime() + t.stime()) /
grand_total) : 0.)
(100.0 * (t.utime() + t.cutime() + t.stime()
+ t.cstime()) / grand_total) : 0.)
<< sep
<< std::setw(4) << i->second.second
<< std::endl;
@ -80,10 +95,10 @@ namespace spot
os << std::setw(79) << std::setfill('-') << "" << std::setfill(' ')
<< std::endl
<< std::setw(22) << "TOTAL" << " |"
<< std::setw(6) << total.utime << ' '
<< std::setw(6) << total.utime + total.cutime << ' '
<< std::setw(8) << 100.
<< " |"
<< std::setw(6) << total.stime << ' '
<< std::setw(6) << total.stime + total.cstime << ' '
<< std::setw(8) << 100.
<< " |"
<< std::setw(6) << grand_total << ' '