Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

perf.h
Go to the documentation of this file.
1 // Copyright (c) 2016 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
6 #ifndef H_PERF
7 #define H_PERF
8 
9 #include <stdint.h>
10 
11 #if defined(__i386__)
12 
13 static inline uint64_t perf_cpucycles(void)
14 {
15  uint64_t x;
16  __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
17  return x;
18 }
19 
20 #elif defined(__x86_64__)
21 
22 static inline uint64_t perf_cpucycles(void)
23 {
24  uint32_t hi, lo;
25  __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi));
26  return ((uint64_t)lo)|(((uint64_t)hi)<<32);
27 }
28 #else
29 
30 uint64_t perf_cpucycles(void);
31 
32 #endif
33 
34 void perf_init(void);
35 void perf_fini(void);
36 
37 #endif // H_PERF
void perf_init(void)
Definition: perf.cpp:49
uint64_t perf_cpucycles(void)
Functions for measurement of CPU cycles.
Definition: perf.cpp:51
void perf_fini(void)
Definition: perf.cpp:50
Released under the MIT license