Commit 82babb9d authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

ltlcheck: Record translation time.

* lib/gethrxtime.h, lib/xtime.h: Add extern "C".
* src/bin/Makefile.am (ltlcheck_LDADD): Use LIB_GETHRXTIME.
* src/bin/ltlcheck.cc: Use gethrxtime() to record translation time.
parent 75631973
......@@ -22,6 +22,10 @@
# include "xtime.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Get the current time, as a count of the number of nanoseconds since
an arbitrary epoch (e.g., the system boot time). Prefer a
high-resolution clock that is not subject to resetting or
......@@ -34,4 +38,8 @@ static inline xtime_t gethrxtime (void) { return gethrtime (); }
xtime_t gethrxtime (void);
# endif
#ifdef __cplusplus
}
#endif
#endif
......@@ -37,6 +37,10 @@ typedef long int xtime_t;
# endif
# endif
#ifdef __cplusplus
extern "C" {
#endif
/* Return an extended time value that contains S seconds and NS
nanoseconds, without any overflow checking. */
static inline xtime_t
......@@ -83,4 +87,8 @@ xtime_nsec (xtime_t t)
return ns;
}
#ifdef __cplusplus
}
#endif
#endif
......@@ -49,3 +49,4 @@ randltl_SOURCES = randltl.cc
ltl2tgba_SOURCES = ltl2tgba.cc
ltl2tgta_SOURCES = ltl2tgta.cc
ltlcheck_SOURCES = ltlcheck.cc
ltlcheck_LDADD = $(LDADD) $(LIB_GETHRXTIME)
......@@ -28,7 +28,7 @@
#include <cstdio>
#include <argp.h>
#include "error.h"
#include <sstream>
#include "gethrxtime.h"
#include "common_setup.hh"
#include "common_cout.hh"
......@@ -113,6 +113,7 @@ struct statistics
unsigned scc;
unsigned nondetstates;
bool nondeterministic;
double time;
unsigned product_states;
unsigned product_transitions;
unsigned product_scc;
......@@ -127,6 +128,7 @@ struct statistics
" \"scc\",\n"
" \"nondetstates\",\n"
" \"nondeterministic\",\n"
" \"time\",\n"
" \"product_states\",\n"
" \"product_transitions\",\n"
" \"product_scc\"");
......@@ -142,6 +144,7 @@ struct statistics
<< scc << ", "
<< nondetstates << ", "
<< nondeterministic << ", "
<< time << ", "
<< product_states << ", "
<< product_transitions << ", "
<< product_scc;
......@@ -365,7 +368,9 @@ namespace
std::string cmd = command.str();
std::cerr << "Running [" << l << translator_num << "]: "
<< cmd << std::endl;
xtime_t before = gethrxtime();
int es = system(cmd.c_str());
xtime_t after = gethrxtime();
const spot::tgba* res = 0;
if (es)
......@@ -429,6 +434,8 @@ namespace
st->scc = m.scc_count();
st->nondetstates = spot::count_nondet_states(res);
st->nondeterministic = st->nondetstates != 0;
double prec = XTIME_PRECISION;
st->time = (after - before) / prec;
}
return res;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment