Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abc
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
abc
Commits
c51c081d
Commit
c51c081d
authored
Jul 25, 2023
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changing default time counting from thread time to wall time.
parent
a3942996
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
2 deletions
+20
-2
src/misc/util/abc_global.h
+20
-2
No files found.
src/misc/util/abc_global.h
View file @
c51c081d
...
@@ -325,8 +325,8 @@ static inline int Abc_Var2Lit4( int Var, int Att ) { assert(!(Att >>
...
@@ -325,8 +325,8 @@ static inline int Abc_Var2Lit4( int Var, int Att ) { assert(!(Att >>
static
inline
int
Abc_Lit2Var4
(
int
Lit
)
{
assert
(
Lit
>=
0
);
return
Lit
>>
4
;
}
static
inline
int
Abc_Lit2Var4
(
int
Lit
)
{
assert
(
Lit
>=
0
);
return
Lit
>>
4
;
}
static
inline
int
Abc_Lit2Att4
(
int
Lit
)
{
assert
(
Lit
>=
0
);
return
Lit
&
15
;
}
static
inline
int
Abc_Lit2Att4
(
int
Lit
)
{
assert
(
Lit
>=
0
);
return
Lit
&
15
;
}
// time counting
typedef
ABC_INT64_T
abctime
;
typedef
ABC_INT64_T
abctime
;
// counting wall time
static
inline
abctime
Abc_Clock
()
static
inline
abctime
Abc_Clock
()
{
{
#if defined(__APPLE__) && defined(__MACH__)
#if defined(__APPLE__) && defined(__MACH__)
...
@@ -336,6 +336,25 @@ static inline abctime Abc_Clock()
...
@@ -336,6 +336,25 @@ static inline abctime Abc_Clock()
#endif
#endif
#if (defined(LIN) || defined(LIN64)) && !APPLE_MACH && !defined(__MINGW32__)
#if (defined(LIN) || defined(LIN64)) && !APPLE_MACH && !defined(__MINGW32__)
struct
timespec
ts
;
struct
timespec
ts
;
if
(
clock_gettime
(
CLOCK_MONOTONIC
,
&
ts
)
<
0
)
return
(
abctime
)
-
1
;
abctime
res
=
((
abctime
)
ts
.
tv_sec
)
*
CLOCKS_PER_SEC
;
res
+=
(((
abctime
)
ts
.
tv_nsec
)
*
CLOCKS_PER_SEC
)
/
1000000000
;
return
res
;
#else
return
(
abctime
)
clock
();
#endif
}
// counting thread time
static
inline
abctime
Abc_ThreadClock
()
{
#if defined(__APPLE__) && defined(__MACH__)
#define APPLE_MACH (__APPLE__ & __MACH__)
#else
#define APPLE_MACH 0
#endif
#if (defined(LIN) || defined(LIN64)) && !APPLE_MACH && !defined(__MINGW32__)
struct
timespec
ts
;
if
(
clock_gettime
(
CLOCK_THREAD_CPUTIME_ID
,
&
ts
)
<
0
)
if
(
clock_gettime
(
CLOCK_THREAD_CPUTIME_ID
,
&
ts
)
<
0
)
return
(
abctime
)
-
1
;
return
(
abctime
)
-
1
;
abctime
res
=
((
abctime
)
ts
.
tv_sec
)
*
CLOCKS_PER_SEC
;
abctime
res
=
((
abctime
)
ts
.
tv_sec
)
*
CLOCKS_PER_SEC
;
...
@@ -346,7 +365,6 @@ static inline abctime Abc_Clock()
...
@@ -346,7 +365,6 @@ static inline abctime Abc_Clock()
#endif
#endif
}
}
// misc printing procedures
// misc printing procedures
enum
Abc_VerbLevel
enum
Abc_VerbLevel
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment