misc/timer: Gather handling of %r and %R options

* bin/autcross.cc: Update.
* bin/autfilt.cc: Update.
* bin/common_aoutput.cc: Gather them. Move process_timer struct.
* bin/common_aoutput.hh: Gather them.
* bin/common_output.hh: Update.
* bin/dstar2tgba.cc: Update.
* bin/ltl2tgba.cc: Update.
* bin/ltlcross.cc: Update.
* bin/ltldo.cc: Update.
* bin/ltlfilt.cc: Update.
* bin/randaut.cc: Update.
* spot/misc/formater.hh: Remove an useless function.
* spot/misc/timer.hh: Add process_timer struct definition.
* spot/misc/timer.cc: Remove old dead code.
* spot/twaalgos/stats.cc: Update.
* spot/twaalgos/stats.hh: Update.
This commit is contained in:
Alexandre GBAGUIDI AISSE 2017-07-24 17:27:23 +02:00
parent 302095ff9e
commit ad9bc644ba
16 changed files with 89 additions and 81 deletions

View file

@ -290,5 +290,38 @@ namespace spot
tm_type tm;
};
/// \brief Struct used to start and stop both timer and stopwatch clocks.
typedef struct process_timer
{
void start()
{
walltimer.start();
cputimer.start();
}
// sw.stop() --> It always returns the duration since the last call to
// start(). Therefore, it wont't stop timing, moreover, it can be called
// multiple times.
void stop()
{
walltime_lap_ = walltimer.stop();
cputimer.stop();
}
double walltime() const
{
return walltime_lap_;
}
clock_t cputime(bool user, bool system, bool children, bool parent) const
{
return cputimer.get_uscp(user, system, children, parent);
}
private:
spot::timer cputimer;
spot::stopwatch walltimer;
double walltime_lap_ = 0;
} process_timer;
/// @}
}