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
e8fc2a2b
Commit
e8fc2a2b
authored
Jul 13, 2017
by
Dominic Hamon
Committed by
GitHub
Jul 13, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Google-style cleanups (#416)
parent
ee3cfca6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
13 deletions
+13
-13
benchmark.h
include/benchmark/benchmark.h
+5
-5
benchmark.cc
src/benchmark.cc
+2
-2
commandlineflags.cc
src/commandlineflags.cc
+3
-3
reporter.cc
src/reporter.cc
+3
-3
No files found.
include/benchmark/benchmark.h
View file @
e8fc2a2b
...
@@ -286,7 +286,7 @@ Benchmark* RegisterBenchmarkInternal(Benchmark*);
...
@@ -286,7 +286,7 @@ Benchmark* RegisterBenchmarkInternal(Benchmark*);
int
InitializeStreams
();
int
InitializeStreams
();
BENCHMARK_UNUSED
static
int
stream_init_anchor
=
InitializeStreams
();
BENCHMARK_UNUSED
static
int
stream_init_anchor
=
InitializeStreams
();
}
//
end
namespace internal
}
// namespace internal
#if !defined(__GNUC__) || defined(__pnacl__) || defined(EMSCRIPTN)
#if !defined(__GNUC__) || defined(__pnacl__) || defined(EMSCRIPTN)
...
@@ -556,7 +556,7 @@ class State {
...
@@ -556,7 +556,7 @@ class State {
const
int
threads
;
const
int
threads
;
const
size_t
max_iterations
;
const
size_t
max_iterations
;
// TODO make me private
// TODO
(EricWF)
make me private
State
(
size_t
max_iters
,
const
std
::
vector
<
int
>&
ranges
,
int
thread_i
,
State
(
size_t
max_iters
,
const
std
::
vector
<
int
>&
ranges
,
int
thread_i
,
int
n_threads
,
internal
::
ThreadTimer
*
timer
,
int
n_threads
,
internal
::
ThreadTimer
*
timer
,
internal
::
ThreadManager
*
manager
);
internal
::
ThreadManager
*
manager
);
...
@@ -671,7 +671,7 @@ class Benchmark {
...
@@ -671,7 +671,7 @@ class Benchmark {
// Specify if each repetition of the benchmark should be reported separately
// Specify if each repetition of the benchmark should be reported separately
// or if only the final statistics should be reported. If the benchmark
// or if only the final statistics should be reported. If the benchmark
// is not repeated then the single result is always reported.
// is not repeated then the single result is always reported.
Benchmark
*
ReportAggregatesOnly
(
bool
v
=
true
);
Benchmark
*
ReportAggregatesOnly
(
bool
v
alue
=
true
);
// If a particular benchmark is I/O bound, runs multiple threads internally or
// If a particular benchmark is I/O bound, runs multiple threads internally or
// if for some reason CPU timings are not representative, call this method. If
// if for some reason CPU timings are not representative, call this method. If
...
@@ -867,7 +867,7 @@ class Fixture : public internal::Benchmark {
...
@@ -867,7 +867,7 @@ class Fixture : public internal::Benchmark {
virtual
void
BenchmarkCase
(
State
&
)
=
0
;
virtual
void
BenchmarkCase
(
State
&
)
=
0
;
};
};
}
//
end namespace benchmark
}
//
namespace internal
// ------------------------------------------------------
// ------------------------------------------------------
// Macro to register benchmarks
// Macro to register benchmarks
...
@@ -1204,6 +1204,6 @@ inline double GetTimeUnitMultiplier(TimeUnit unit) {
...
@@ -1204,6 +1204,6 @@ inline double GetTimeUnitMultiplier(TimeUnit unit) {
}
}
}
}
}
//
end
namespace benchmark
}
// namespace benchmark
#endif // BENCHMARK_BENCHMARK_H_
#endif // BENCHMARK_BENCHMARK_H_
src/benchmark.cc
View file @
e8fc2a2b
...
@@ -595,13 +595,13 @@ size_t RunSpecifiedBenchmarks(BenchmarkReporter* console_reporter,
...
@@ -595,13 +595,13 @@ size_t RunSpecifiedBenchmarks(BenchmarkReporter* console_reporter,
auto
&
Err
=
console_reporter
->
GetErrorStream
();
auto
&
Err
=
console_reporter
->
GetErrorStream
();
std
::
string
const
&
fname
=
FLAGS_benchmark_out
;
std
::
string
const
&
fname
=
FLAGS_benchmark_out
;
if
(
fname
==
""
&&
file_reporter
)
{
if
(
fname
.
empty
()
&&
file_reporter
)
{
Err
<<
"A custom file reporter was provided but "
Err
<<
"A custom file reporter was provided but "
"--benchmark_out=<file> was not specified."
"--benchmark_out=<file> was not specified."
<<
std
::
endl
;
<<
std
::
endl
;
std
::
exit
(
1
);
std
::
exit
(
1
);
}
}
if
(
fname
!=
""
)
{
if
(
!
fname
.
empty
()
)
{
output_file
.
open
(
fname
);
output_file
.
open
(
fname
);
if
(
!
output_file
.
is_open
())
{
if
(
!
output_file
.
is_open
())
{
Err
<<
"invalid file name: '"
<<
fname
<<
std
::
endl
;
Err
<<
"invalid file name: '"
<<
fname
<<
std
::
endl
;
...
...
src/commandlineflags.cc
View file @
e8fc2a2b
...
@@ -209,9 +209,9 @@ bool IsFlag(const char* str, const char* flag) {
...
@@ -209,9 +209,9 @@ bool IsFlag(const char* str, const char* flag) {
return
(
ParseFlagValue
(
str
,
flag
,
true
)
!=
nullptr
);
return
(
ParseFlagValue
(
str
,
flag
,
true
)
!=
nullptr
);
}
}
bool
IsTruthyFlagValue
(
const
std
::
string
&
str
)
{
bool
IsTruthyFlagValue
(
const
std
::
string
&
value
)
{
if
(
str
.
empty
())
return
true
;
if
(
value
.
empty
())
return
true
;
char
ch
=
str
[
0
];
char
ch
=
value
[
0
];
return
isalnum
(
ch
)
&&
return
isalnum
(
ch
)
&&
!
(
ch
==
'0'
||
ch
==
'f'
||
ch
==
'F'
||
ch
==
'n'
||
ch
==
'N'
);
!
(
ch
==
'0'
||
ch
==
'f'
||
ch
==
'F'
||
ch
==
'n'
||
ch
==
'N'
);
}
}
...
...
src/reporter.cc
View file @
e8fc2a2b
...
@@ -31,10 +31,10 @@ BenchmarkReporter::BenchmarkReporter()
...
@@ -31,10 +31,10 @@ BenchmarkReporter::BenchmarkReporter()
BenchmarkReporter
::~
BenchmarkReporter
()
{}
BenchmarkReporter
::~
BenchmarkReporter
()
{}
void
BenchmarkReporter
::
PrintBasicContext
(
std
::
ostream
*
out
_ptr
,
void
BenchmarkReporter
::
PrintBasicContext
(
std
::
ostream
*
out
,
Context
const
&
context
)
{
Context
const
&
context
)
{
CHECK
(
out
_ptr
)
<<
"cannot be null"
;
CHECK
(
out
)
<<
"cannot be null"
;
auto
&
Out
=
*
out
_ptr
;
auto
&
Out
=
*
out
;
Out
<<
"Run on ("
<<
context
.
num_cpus
<<
" X "
<<
context
.
mhz_per_cpu
Out
<<
"Run on ("
<<
context
.
num_cpus
<<
" X "
<<
context
.
mhz_per_cpu
<<
" MHz CPU "
<<
((
context
.
num_cpus
>
1
)
?
"s"
:
""
)
<<
")
\n
"
;
<<
" MHz CPU "
<<
((
context
.
num_cpus
>
1
)
?
"s"
:
""
)
<<
")
\n
"
;
...
...
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