Changeset View
Changeset View
Standalone View
Standalone View
src/bench/perf.h
// Copyright (c) 2016 The Bitcoin Core developers | // Copyright (c) 2016 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
/** Functions for measurement of CPU cycles */ | /** Functions for measurement of CPU cycles */ | ||||
#ifndef H_PERF | #ifndef H_PERF | ||||
#define H_PERF | #define H_PERF | ||||
#include <stdint.h> | #include <cstdint> | ||||
#if defined(__i386__) | #if defined(__i386__) | ||||
static inline uint64_t perf_cpucycles(void) { | static inline uint64_t perf_cpucycles(void) { | ||||
uint64_t x; | uint64_t x; | ||||
__asm__ volatile(".byte 0x0f, 0x31" : "=A"(x)); | __asm__ volatile(".byte 0x0f, 0x31" : "=A"(x)); | ||||
return x; | return x; | ||||
} | } | ||||
Show All 18 Lines |