df6d458b85
* Remove orphan state wipe from UnloadBlockIndex. As orphan state is now "network state", like in d6ea737be19a0001e69e4e854eb1cef21523ea7a, UnloadBlockIndex is only used during init if we end up reindexing to clear our block state so that we can start over. However, at that time no connections have been brought up as CConnman hasn't been started yet, so all of the network processing state logic is empty when its called. * Move network-msg-processing code out of main to its own file * Rename the remaining main.{h,cpp} to validation.{h,cpp}
35 lines
788 B
C++
35 lines
788 B
C++
// Copyright (c) 2015 The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#include "bench.h"
|
|
#include "validation.h"
|
|
#include "utiltime.h"
|
|
|
|
// Sanity test: this should loop ten times, and
|
|
// min/max/average should be close to 100ms.
|
|
static void Sleep100ms(benchmark::State& state)
|
|
{
|
|
while (state.KeepRunning()) {
|
|
MilliSleep(100);
|
|
}
|
|
}
|
|
|
|
BENCHMARK(Sleep100ms);
|
|
|
|
// Extremely fast-running benchmark:
|
|
#include <math.h>
|
|
|
|
volatile double sum = 0.0; // volatile, global so not optimized away
|
|
|
|
static void Trig(benchmark::State& state)
|
|
{
|
|
double d = 0.01;
|
|
while (state.KeepRunning()) {
|
|
sum += sin(d);
|
|
d += 0.000001;
|
|
}
|
|
}
|
|
|
|
BENCHMARK(Trig);
|