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:
parent
302095ff9e
commit
ad9bc644ba
16 changed files with 89 additions and 81 deletions
|
|
@ -25,8 +25,6 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#define UNUSED(expr) do { (void)(expr); } while (0)
|
||||
|
||||
namespace spot
|
||||
{
|
||||
class printable
|
||||
|
|
@ -88,15 +86,6 @@ namespace spot
|
|||
}
|
||||
};
|
||||
|
||||
// This function was defined to avoid compilation error when
|
||||
// instantiating function spot::printable_value<spot::timer>::print
|
||||
// because of: os << val_;
|
||||
std::ostream& operator<<(std::ostream& os, const timer& dt)
|
||||
{
|
||||
UNUSED(dt);
|
||||
return os;
|
||||
}
|
||||
|
||||
/// The default callback simply writes "%c".
|
||||
class printable_id: public printable
|
||||
{
|
||||
|
|
|
|||
|
|
@ -27,15 +27,6 @@
|
|||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
/// @}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -343,7 +343,6 @@ namespace spot
|
|||
declare('g', &gen_acc_);
|
||||
declare('n', &nondetstates_);
|
||||
declare('p', &complete_);
|
||||
declare('r', &run_time_);
|
||||
declare('s', &states_);
|
||||
declare('S', &scc_); // Historical. Deprecated. Use %c instead.
|
||||
declare('t', &trans_);
|
||||
|
|
@ -353,11 +352,9 @@ namespace spot
|
|||
}
|
||||
|
||||
std::ostream&
|
||||
stat_printer::print(const const_twa_graph_ptr& aut,
|
||||
formula f, double run_time)
|
||||
stat_printer::print(const const_twa_graph_ptr& aut, formula f)
|
||||
{
|
||||
form_ = f;
|
||||
run_time_ = run_time;
|
||||
|
||||
if (has('t'))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -103,8 +103,7 @@ namespace spot
|
|||
/// The \a f argument is not needed if the Formula does not need
|
||||
/// to be output, and so is \a run_time).
|
||||
std::ostream&
|
||||
print(const const_twa_graph_ptr& aut, formula f = nullptr,
|
||||
double run_time = -1.);
|
||||
print(const const_twa_graph_ptr& aut, formula f = nullptr);
|
||||
|
||||
private:
|
||||
const char* format_;
|
||||
|
|
@ -118,7 +117,6 @@ namespace spot
|
|||
printable_value<unsigned> nondetstates_;
|
||||
printable_value<unsigned> deterministic_;
|
||||
printable_value<unsigned> complete_;
|
||||
printable_value<double> run_time_;
|
||||
printable_value<std::string> gen_acc_;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue