mirror of https://github.com/YosysHQ/abc.git
Suggested changes to counting time in Abc_Clock()
This commit is contained in:
parent
b91c41659e
commit
13dd754a8c
2
Makefile
2
Makefile
|
|
@ -62,7 +62,7 @@ endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LIBS := -ldl
|
LIBS := -ldl -lrt
|
||||||
|
|
||||||
ifneq ($(READLINE),0)
|
ifneq ($(READLINE),0)
|
||||||
CFLAGS += -DABC_USE_READLINE
|
CFLAGS += -DABC_USE_READLINE
|
||||||
|
|
|
||||||
|
|
@ -271,17 +271,17 @@ static inline int Abc_Lit2LitL( int * pMap, int Lit ) { return Abc_LitNo
|
||||||
typedef ABC_INT64_T abctime;
|
typedef ABC_INT64_T abctime;
|
||||||
static inline abctime Abc_Clock()
|
static inline abctime Abc_Clock()
|
||||||
{
|
{
|
||||||
static abctime PeriodNum = 0;
|
#if defined(LIN) || defined(LIN64)
|
||||||
static clock_t Period = ((abctime)1 << 30);
|
struct timespec ts;
|
||||||
clock_t ClockTime = clock();
|
if ( clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts) < 0 )
|
||||||
if ( ClockTime >= Period )
|
return (abctime)-1;
|
||||||
{
|
abctime res = ((abctime) ts.tv_sec) * CLOCKS_PER_SEC;
|
||||||
ClockTime -= Period;
|
res += (((abctime) ts.tv_nsec) * CLOCKS_PER_SEC) / 1000000000;
|
||||||
PeriodNum++;
|
return res;
|
||||||
|
#else
|
||||||
|
return (abctime) clock();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return PeriodNum * Period + ClockTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// bridge communication
|
// bridge communication
|
||||||
#define BRIDGE_NETLIST 106
|
#define BRIDGE_NETLIST 106
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue