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
290bd602
Commit
290bd602
authored
May 21, 2016
by
Ismael
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor for pull request
parent
2e5c397b
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
19 additions
and
15 deletions
+19
-15
AUTHORS
AUTHORS
+1
-0
CONTRIBUTORS
CONTRIBUTORS
+1
-0
benchmark_api.h
include/benchmark/benchmark_api.h
+4
-3
reporter.h
include/benchmark/reporter.h
+1
-1
minimal_leastsq.cc
src/minimal_leastsq.cc
+1
-1
minimal_leastsq.h
src/minimal_leastsq.h
+2
-2
reporter.cc
src/reporter.cc
+2
-2
complexity_test.cc
test/complexity_test.cc
+7
-6
No files found.
AUTHORS
View file @
290bd602
...
...
@@ -16,6 +16,7 @@ Eugene Zhuk <eugene.zhuk@gmail.com>
Evgeny Safronov <division494@gmail.com>
Felix Homann <linuxaudio@showlabor.de>
Google Inc.
Ismael Jimenez Martinez <ismael.jimenez.martinez@gmail.com>
JianXiong Zhou <zhoujianxiong2@gmail.com>
Jussi Knuuttila <jussi.knuuttila@gmail.com>
Kaito Udagawa <umireon@gmail.com>
...
...
CONTRIBUTORS
View file @
290bd602
...
...
@@ -31,6 +31,7 @@ Dominic Hamon <dma@stripysock.com>
Eugene Zhuk <eugene.zhuk@gmail.com>
Evgeny Safronov <division494@gmail.com>
Felix Homann <linuxaudio@showlabor.de>
Ismael Jimenez Martinez <ismael.jimenez.martinez@gmail.com>
JianXiong Zhou <zhoujianxiong2@gmail.com>
Jussi Knuuttila <jussi.knuuttila@gmail.com>
Kaito Udagawa <umireon@gmail.com>
...
...
include/benchmark/benchmark_api.h
View file @
290bd602
...
...
@@ -232,7 +232,8 @@ enum TimeUnit {
};
// BigO is passed to a benchmark in order to specify the asymptotic computational
// complexity for the benchmark.
// complexity for the benchmark. In case O_Auto is selected, complexity will be
// calculated automatically to the best fit.
enum
BigO
{
O_None
,
O_1
,
...
...
@@ -479,8 +480,8 @@ public:
// or MB/second values.
Benchmark
*
UseManualTime
();
// Set the asymptotic computational complexity for the benchmark.
This option
//
called
the asymptotic computational complexity will be shown on the output.
// Set the asymptotic computational complexity for the benchmark.
If called
// the asymptotic computational complexity will be shown on the output.
Benchmark
*
Complexity
(
BigO
complexity
);
// Support for running multiple copies of the same benchmark concurrently
...
...
include/benchmark/reporter.h
View file @
290bd602
...
...
@@ -74,7 +74,7 @@ class BenchmarkReporter {
int
arg1
;
int
arg2
;
// Inform print function
if
the current run is a complexity report
// Inform print function
whether
the current run is a complexity report
bool
report_bigO
;
bool
report_rms
;
};
...
...
src/minimal_leastsq.cc
View file @
290bd602
...
...
@@ -13,7 +13,7 @@
// limitations under the License.
// Source project : https://github.com/ismaelJimenez/cpp.leastsq
// Ad
d
apted to be used with google benchmark
// Adapted to be used with google benchmark
#include "minimal_leastsq.h"
...
...
src/minimal_leastsq.h
View file @
290bd602
...
...
@@ -13,7 +13,7 @@
// limitations under the License.
// Source project : https://github.com/ismaelJimenez/cpp.leastsq
// Ad
d
apted to be used with google benchmark
// Adapted to be used with google benchmark
#if !defined(MINIMAL_LEASTSQ_H_)
#define MINIMAL_LEASTSQ_H_
...
...
@@ -22,7 +22,7 @@
#include <vector>
// This data structure will contain the result returned
v
y minimalLeastSq
// This data structure will contain the result returned
b
y minimalLeastSq
// - coef : Estimated coeficient for the high-order term as interpolated from data.
// - rms : Normalized Root Mean Squared Error.
// - complexity : Scalability form (e.g. O_N, O_N_log_N). In case a scalability form has been provided to minimalLeastSq
...
...
src/reporter.cc
View file @
290bd602
...
...
@@ -85,11 +85,11 @@ void BenchmarkReporter::ComputeBigO(
CHECK
(
reports
.
size
()
>=
2
)
<<
"Cannot compute asymptotic complexity for less than 2 reports"
;
// Accumulators.
std
::
vector
<
int
>
N
;
std
::
vector
<
double
>
RealTime
;
std
::
vector
<
double
>
RealTime
;
std
::
vector
<
double
>
CpuTime
;
// Populate the accumulators.
for
(
Run
const
&
run
:
reports
)
{
for
(
const
Run
&
run
:
reports
)
{
N
.
push_back
(
run
.
arg1
);
RealTime
.
push_back
(
run
.
real_accumulated_time
/
run
.
iterations
);
CpuTime
.
push_back
(
run
.
cpu_accumulated_time
/
run
.
iterations
);
...
...
test/complexity_test.cc
View file @
290bd602
...
...
@@ -36,8 +36,8 @@ static void BM_Complexity_O_N(benchmark::State& state) {
benchmark
::
DoNotOptimize
(
std
::
find
(
v
.
begin
(),
v
.
end
(),
itemNotInVector
));
}
}
BENCHMARK
(
BM_Complexity_O_N
)
->
RangeMultiplier
(
2
)
->
Range
(
1
<<
10
,
1
<<
16
)
->
Complexity
(
benchmark
::
O_N
);
BENCHMARK
(
BM_Complexity_O_N
)
->
RangeMultiplier
(
2
)
->
Range
(
1
<<
10
,
1
<<
16
)
->
Complexity
(
benchmark
::
O_Auto
);
BENCHMARK
(
BM_Complexity_O_N
)
->
RangeMultiplier
(
2
)
->
Range
(
1
<<
10
,
1
<<
16
)
->
Complexity
(
benchmark
::
O_N
);
BENCHMARK
(
BM_Complexity_O_N
)
->
RangeMultiplier
(
2
)
->
Range
(
1
<<
10
,
1
<<
16
)
->
Complexity
(
benchmark
::
O_Auto
);
static
void
BM_Complexity_O_N_Squared
(
benchmark
::
State
&
state
)
{
std
::
string
s1
(
state
.
range_x
(),
'-'
);
...
...
@@ -77,7 +77,7 @@ static void BM_Complexity_O_log_N(benchmark::State& state) {
}
}
BENCHMARK
(
BM_Complexity_O_log_N
)
->
RangeMultiplier
(
2
)
->
Range
(
1
<<
10
,
1
<<
16
)
->
Complexity
(
benchmark
::
O_log_N
);
->
RangeMultiplier
(
2
)
->
Range
(
1
<<
10
,
1
<<
16
)
->
Complexity
(
benchmark
::
O_log_N
);
static
void
BM_Complexity_O_N_log_N
(
benchmark
::
State
&
state
)
{
auto
v
=
ConstructRandomVector
(
state
.
range_x
());
...
...
@@ -85,8 +85,8 @@ static void BM_Complexity_O_N_log_N(benchmark::State& state) {
std
::
sort
(
v
.
begin
(),
v
.
end
());
}
}
BENCHMARK
(
BM_Complexity_O_N_log_N
)
->
RangeMultiplier
(
2
)
->
Range
(
1
<<
10
,
1
<<
16
)
->
Complexity
(
benchmark
::
O_N_log_N
);
BENCHMARK
(
BM_Complexity_O_N_log_N
)
->
RangeMultiplier
(
2
)
->
Range
(
1
<<
10
,
1
<<
16
)
->
Complexity
(
benchmark
::
O_Auto
);
BENCHMARK
(
BM_Complexity_O_N_log_N
)
->
RangeMultiplier
(
2
)
->
Range
(
1
<<
10
,
1
<<
16
)
->
Complexity
(
benchmark
::
O_N_log_N
);
BENCHMARK
(
BM_Complexity_O_N_log_N
)
->
RangeMultiplier
(
2
)
->
Range
(
1
<<
10
,
1
<<
16
)
->
Complexity
(
benchmark
::
O_Auto
);
// Test benchmark with no range and check no complexity is calculated.
void
BM_Extreme_Cases
(
benchmark
::
State
&
state
)
{
...
...
@@ -94,6 +94,6 @@ void BM_Extreme_Cases(benchmark::State& state) {
}
}
BENCHMARK
(
BM_Extreme_Cases
)
->
Complexity
(
benchmark
::
O_N_log_N
);
BENCHMARK
(
BM_Extreme_Cases
)
->
Arg
(
42
)
->
Complexity
(
benchmark
::
O_Auto
);
BENCHMARK
(
BM_Extreme_Cases
)
->
Arg
(
42
)
->
Complexity
(
benchmark
::
O_Auto
);
BENCHMARK_MAIN
()
\ No newline at end of file
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