ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
rewire_time.h
Go to the documentation of this file.
1
20
21#ifndef RAR_TIME_H
22#define RAR_TIME_H
23
24/*************************************************************
25 counting wall time
26**************************************************************/
27
28#include "base/abc/abc.h"
29
31
32static inline iword Time_Clock() {
33#if defined(__APPLE__) && defined(__MACH__)
34#define APPLE_MACH (__APPLE__ & __MACH__)
35#else
36#define APPLE_MACH 0
37#endif
38#if (defined(LIN) || defined(LIN64)) && !APPLE_MACH && !defined(__MINGW32__)
39 struct timespec ts;
40 if (clock_gettime(CLOCK_MONOTONIC, &ts) < 0)
41 return (iword)-1;
42 iword res = ((iword)ts.tv_sec) * CLOCKS_PER_SEC;
43 res += (((iword)ts.tv_nsec) * CLOCKS_PER_SEC) / 1000000000;
44 return res;
45#else
46 return (iword)clock();
47#endif
48}
49
50static inline void Time_Print(const char *pStr, iword time) {
51 printf("%s = %10.2f sec", pStr, (float)1.0 * ((double)(time)) / ((double)CLOCKS_PER_SEC));
52}
53
54static inline void Time_PrintEndl(const char *pStr, iword time) {
55 Time_Print(pStr, time);
56 printf("\n");
57}
58
60
61#endif // RAR_TIME_H
ABC_INT64_T iword
Definition abc_global.h:244
#define ABC_NAMESPACE_HEADER_END
#define ABC_NAMESPACE_HEADER_START
NAMESPACES ///.