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