Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F10907626
Examples.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
792 B
Subscribers
None
Examples.cpp
View Options
// Copyright (c) 2015-2016 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
"utiltime.h"
#include
"validation.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
<cmath>
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
);
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Mon, Nov 25, 08:06 (1 d, 19 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4532922
Default Alt Text
Examples.cpp (792 B)
Attached To
rSTAGING Bitcoin ABC staging
Event Timeline
Log In to Comment