Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
benchmark
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
benchmark
Commits
8f5cd976
Commit
8f5cd976
authored
Mar 09, 2015
by
Eric Fiselier
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'upgrade-step2' into upgrade-step3
parents
a187aa08
d20cdf19
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
9 deletions
+14
-9
.travis.yml
.travis.yml
+1
-1
benchmark.cc
src/benchmark.cc
+3
-0
walltime.cc
src/walltime.cc
+10
-8
No files found.
.travis.yml
View file @
8f5cd976
...
...
@@ -30,4 +30,4 @@ before_script:
script
:
-
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_CXX_FLAGS="-std=${STD}"
-
make
-
make test
-
make
CTEST_OUTPUT_ON_FAILURE=1
test
src/benchmark.cc
View file @
8f5cd976
...
...
@@ -1179,6 +1179,9 @@ void RunSpecifiedBenchmarks(const BenchmarkReporter* reporter /*= nullptr*/) {
void
Initialize
(
int
*
argc
,
const
char
**
argv
)
{
internal
::
ParseCommandLineFlags
(
argc
,
argv
);
internal
::
SetLogLevel
(
FLAGS_v
);
// Ensure walltime is initialized by a single thread by forcing the
// initialization.
walltime
::
Now
();
internal
::
Benchmark
::
MeasureOverhead
();
}
...
...
src/walltime.cc
View file @
8f5cd976
...
...
@@ -15,10 +15,12 @@
#include "walltime.h"
#include <sys/time.h>
#include <time.h>
#include <cstdio>
#include <cstdint>
#include <cstring>
#include <ctime>
#include <atomic>
#include <limits>
#include <type_traits>
...
...
@@ -31,8 +33,8 @@ namespace benchmark {
namespace
walltime
{
namespace
{
inline
bool
SplitTimezone
(
WallTime
value
,
bool
local
,
struct
tm
*
t
,
double
*
subsecond
)
{
bool
SplitTimezone
(
WallTime
value
,
bool
local
,
struct
tm
*
t
,
double
*
subsecond
)
{
memset
(
t
,
0
,
sizeof
(
*
t
));
if
((
value
<
0
)
||
(
value
>
std
::
numeric_limits
<
time_t
>::
max
()))
{
*
subsecond
=
0.0
;
...
...
@@ -50,14 +52,14 @@ inline bool SplitTimezone(WallTime value, bool local, struct tm* t,
}
// end anonymous namespace
namespace
internal
{
namespace
{
class
WallTimeImp
{
public
:
WallTime
Now
();
static
WallTimeImp
&
GetWallTimeImp
()
{
static
WallTimeImp
&
GetWallTimeImp
()
{
static
WallTimeImp
imp
;
#if __cplusplus >= 201103L
static_assert
(
std
::
is_trivially_destructible
<
WallTimeImp
>::
value
,
...
...
@@ -85,7 +87,7 @@ private:
return
f
;
}
WallTime
Slow
()
{
WallTime
Slow
()
const
{
struct
timeval
tv
;
gettimeofday
(
&
tv
,
NULL
);
return
tv
.
tv_sec
+
tv
.
tv_usec
*
1e-6
;
...
...
@@ -158,12 +160,12 @@ WallTimeImp::WallTimeImp()
last_adjust_time_
=
static_cast
<
uint32_t
>
(
uint64_t
(
base_cycletime_
)
>>
32
);
}
}
// end
namespace internal
}
// end
anonymous namespace
WallTime
Now
()
{
static
internal
::
WallTimeImp
&
imp
=
internal
::
WallTimeImp
::
GetWallTimeImp
();
static
WallTimeImp
&
imp
=
WallTimeImp
::
GetWallTimeImp
();
return
imp
.
Now
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment