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
84cd50b8
Commit
84cd50b8
authored
May 31, 2016
by
Billy O'Neal
Committed by
Dominic Hamon
May 31, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add workaround for VS2013 const-incorrect atomic (#230)
parent
3685cad6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
benchmark.cc
src/benchmark.cc
+11
-4
No files found.
src/benchmark.cc
View file @
84cd50b8
...
@@ -115,7 +115,13 @@ std::string* GetReportLabel() {
...
@@ -115,7 +115,13 @@ std::string* GetReportLabel() {
// Global variable so that a benchmark can report an error as a human readable
// Global variable so that a benchmark can report an error as a human readable
// string. If error_message is null no error occurred.
// string. If error_message is null no error occurred.
static
std
::
atomic
<
const
char
*>
error_message
=
ATOMIC_VAR_INIT
(
nullptr
);
#if defined(_MSC_VER) && _MSC_VER <= 1800
typedef
char
*
error_message_type
;
#else
typedef
const
char
*
error_message_type
;
#endif
static
std
::
atomic
<
error_message_type
>
error_message
=
ATOMIC_VAR_INIT
(
nullptr
);
// TODO(ericwf): support MallocCounter.
// TODO(ericwf): support MallocCounter.
//static benchmark::MallocCounter *benchmark_mc;
//static benchmark::MallocCounter *benchmark_mc;
...
@@ -807,7 +813,7 @@ void RunBenchmark(const benchmark::internal::Benchmark::Instance& b,
...
@@ -807,7 +813,7 @@ void RunBenchmark(const benchmark::internal::Benchmark::Instance& b,
MutexLock
l
(
GetBenchmarkLock
());
MutexLock
l
(
GetBenchmarkLock
());
label
=
*
GetReportLabel
();
label
=
*
GetReportLabel
();
}
}
const
char
*
error_msg
=
error_message
;
error_message_type
error_msg
=
error_message
;
const
double
min_time
=
!
IsZero
(
b
.
min_time
)
?
b
.
min_time
const
double
min_time
=
!
IsZero
(
b
.
min_time
)
?
b
.
min_time
:
FLAGS_benchmark_min_time
;
:
FLAGS_benchmark_min_time
;
...
@@ -929,8 +935,9 @@ void State::ResumeTiming() {
...
@@ -929,8 +935,9 @@ void State::ResumeTiming() {
void
State
::
SkipWithError
(
const
char
*
msg
)
{
void
State
::
SkipWithError
(
const
char
*
msg
)
{
CHECK
(
msg
);
CHECK
(
msg
);
error_occurred_
=
true
;
error_occurred_
=
true
;
const
char
*
expected_no_error_msg
=
nullptr
;
error_message_type
expected_no_error_msg
=
nullptr
;
error_message
.
compare_exchange_weak
(
expected_no_error_msg
,
msg
);
error_message
.
compare_exchange_weak
(
expected_no_error_msg
,
const_cast
<
error_message_type
>
(
msg
));
started_
=
finished_
=
true
;
started_
=
finished_
=
true
;
total_iterations_
=
max_iterations
;
total_iterations_
=
max_iterations
;
timer_manager
->
RemoveErroredThread
();
timer_manager
->
RemoveErroredThread
();
...
...
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