Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
utilities.hpp
Go to the documentation of this file.
1
7#pragma once
8
9#include <cstdint>
10#include <time.h> // NOLINT(modernize-deprecated-headers) - need POSIX clock_gettime/CLOCK_MONOTONIC
11
12#if defined(__x86_64__) || defined(_M_X64)
13#include <immintrin.h>
14#define IPC_PAUSE() _mm_pause()
15#else
16#define IPC_PAUSE() \
17 do { \
18 } while (0)
19#endif
20
21namespace bb::ipc {
22
31inline uint64_t mono_ns_now()
32{
33 struct timespec ts;
34 if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) {
35 return 0;
36 }
37 return (static_cast<uint64_t>(ts.tv_sec) * 1000000000ULL) + static_cast<uint64_t>(ts.tv_nsec);
38}
39
40} // namespace bb::ipc
uint64_t mono_ns_now()
Get current monotonic time in nanoseconds.
Definition utilities.hpp:31