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
c5f238b1
Commit
c5f238b1
authored
Mar 27, 2015
by
Eric Fiselier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix column width calculation and remove duplicate test
parent
4bf6ceb5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
27 deletions
+5
-27
benchmark.cc
src/benchmark.cc
+4
-16
benchmark_test.cc
test/benchmark_test.cc
+1
-11
No files found.
src/benchmark.cc
View file @
c5f238b1
...
@@ -802,26 +802,14 @@ void RunMatchingBenchmarks(const std::string& spec,
...
@@ -802,26 +802,14 @@ void RunMatchingBenchmarks(const std::string& spec,
auto
families
=
benchmark
::
internal
::
BenchmarkFamilies
::
GetInstance
();
auto
families
=
benchmark
::
internal
::
BenchmarkFamilies
::
GetInstance
();
if
(
!
families
->
FindBenchmarks
(
spec
,
&
benchmarks
))
return
;
if
(
!
families
->
FindBenchmarks
(
spec
,
&
benchmarks
))
return
;
// Determine the width of the name field using a minimum width of 10.
// Determine the width of the name field using a minimum width of 10.
// Also determine max number of threads needed.
size_t
name_field_width
=
10
;
size_t
name_field_width
=
10
;
for
(
const
internal
::
Benchmark
::
Instance
&
benchmark
:
benchmarks
)
{
for
(
const
internal
::
Benchmark
::
Instance
&
benchmark
:
benchmarks
)
{
// Add width for _stddev and threads:XX
name_field_width
=
if
(
benchmark
.
threads
>
1
&&
FLAGS_benchmark_repetitions
>
1
)
{
std
::
max
<
size_t
>
(
name_field_width
,
benchmark
.
name
.
size
());
name_field_width
=
std
::
max
<
size_t
>
(
name_field_width
,
benchmark
.
name
.
size
()
+
17
);
}
else
if
(
benchmark
.
threads
>
1
)
{
name_field_width
=
std
::
max
<
size_t
>
(
name_field_width
,
benchmark
.
name
.
size
()
+
10
);
}
else
if
(
FLAGS_benchmark_repetitions
>
1
)
{
name_field_width
=
std
::
max
<
size_t
>
(
name_field_width
,
benchmark
.
name
.
size
()
+
7
);
}
else
{
name_field_width
=
std
::
max
<
size_t
>
(
name_field_width
,
benchmark
.
name
.
size
());
}
}
}
if
(
FLAGS_benchmark_repetitions
>
1
)
name_field_width
+=
std
::
strlen
(
"_stddev"
);
// Print header here
// Print header here
BenchmarkReporter
::
Context
context
;
BenchmarkReporter
::
Context
context
;
...
...
test/benchmark_test.cc
View file @
c5f238b1
...
@@ -58,17 +58,7 @@ static void BM_Factorial(benchmark::State& state) {
...
@@ -58,17 +58,7 @@ static void BM_Factorial(benchmark::State& state) {
state
.
SetLabel
(
ss
.
str
());
state
.
SetLabel
(
ss
.
str
());
}
}
BENCHMARK
(
BM_Factorial
);
BENCHMARK
(
BM_Factorial
);
BENCHMARK
(
BM_Factorial
)
->
UseRealTime
();
static
void
BM_FactorialRealTime
(
benchmark
::
State
&
state
)
{
int
fac_42
=
0
;
while
(
state
.
KeepRunning
())
fac_42
=
Factorial
(
8
);
// Prevent compiler optimizations
std
::
stringstream
ss
;
ss
<<
fac_42
;
state
.
SetLabel
(
ss
.
str
());
}
BENCHMARK
(
BM_FactorialRealTime
)
->
UseRealTime
();
static
void
BM_CalculatePiRange
(
benchmark
::
State
&
state
)
{
static
void
BM_CalculatePiRange
(
benchmark
::
State
&
state
)
{
double
pi
=
0.0
;
double
pi
=
0.0
;
...
...
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