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
0c23d285
Commit
0c23d285
authored
May 23, 2016
by
Ismael
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extracted BigO and GetBigO in own file
parent
266b3bd6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
34 deletions
+44
-34
benchmark_api.h
include/benchmark/benchmark_api.h
+1
-14
complexity.h
include/benchmark/complexity.h
+43
-0
reporter.h
include/benchmark/reporter.h
+0
-1
reporter.cc
src/reporter.cc
+0
-19
No files found.
include/benchmark/benchmark_api.h
View file @
0c23d285
...
@@ -154,6 +154,7 @@ BENCHMARK(BM_test)->Unit(benchmark::kMillisecond);
...
@@ -154,6 +154,7 @@ BENCHMARK(BM_test)->Unit(benchmark::kMillisecond);
#include <stdint.h>
#include <stdint.h>
#include "macros.h"
#include "macros.h"
#include "complexity.h"
namespace
benchmark
{
namespace
benchmark
{
class
BenchmarkReporter
;
class
BenchmarkReporter
;
...
@@ -231,20 +232,6 @@ enum TimeUnit {
...
@@ -231,20 +232,6 @@ enum TimeUnit {
kMillisecond
kMillisecond
};
};
// BigO is passed to a benchmark in order to specify the asymptotic computational
// complexity for the benchmark. In case oAuto is selected, complexity will be
// calculated automatically to the best fit.
enum
BigO
{
oNone
,
o1
,
oN
,
oNSquared
,
oNCubed
,
oLogN
,
oNLogN
,
oAuto
};
// State is passed to a running Benchmark and contains state for the
// State is passed to a running Benchmark and contains state for the
// benchmark to use.
// benchmark to use.
class
State
{
class
State
{
...
...
include/benchmark/complexity.h
0 → 100644
View file @
0c23d285
#ifndef COMPLEXITY_H_
#define COMPLEXITY_H_
#include <string>
namespace
benchmark
{
// BigO is passed to a benchmark in order to specify the asymptotic computational
// complexity for the benchmark. In case oAuto is selected, complexity will be
// calculated automatically to the best fit.
enum
BigO
{
oNone
,
o1
,
oN
,
oNSquared
,
oNCubed
,
oLogN
,
oNLogN
,
oAuto
};
inline
std
::
string
GetBigO
(
BigO
complexity
)
{
switch
(
complexity
)
{
case
oN
:
return
"* N"
;
case
oNSquared
:
return
"* N**2"
;
case
oNCubed
:
return
"* N**3"
;
case
oLogN
:
return
"* lgN"
;
case
oNLogN
:
return
"* NlgN"
;
case
o1
:
return
"* 1"
;
default
:
return
""
;
}
}
}
// end namespace benchmark
#endif // COMPLEXITY_H_
\ No newline at end of file
include/benchmark/reporter.h
View file @
0c23d285
...
@@ -108,7 +108,6 @@ protected:
...
@@ -108,7 +108,6 @@ protected:
static
void
ComputeStats
(
const
std
::
vector
<
Run
>
&
reports
,
Run
*
mean
,
Run
*
stddev
);
static
void
ComputeStats
(
const
std
::
vector
<
Run
>
&
reports
,
Run
*
mean
,
Run
*
stddev
);
static
void
ComputeBigO
(
const
std
::
vector
<
Run
>
&
reports
,
Run
*
bigO
,
Run
*
rms
);
static
void
ComputeBigO
(
const
std
::
vector
<
Run
>
&
reports
,
Run
*
bigO
,
Run
*
rms
);
static
TimeUnitMultiplier
GetTimeUnitAndMultiplier
(
TimeUnit
unit
);
static
TimeUnitMultiplier
GetTimeUnitAndMultiplier
(
TimeUnit
unit
);
static
std
::
string
GetBigO
(
BigO
complexity
);
};
};
// Simple reporter that outputs benchmark data to the console. This is the
// Simple reporter that outputs benchmark data to the console. This is the
...
...
src/reporter.cc
View file @
0c23d285
...
@@ -128,25 +128,6 @@ void BenchmarkReporter::ComputeBigO(
...
@@ -128,25 +128,6 @@ void BenchmarkReporter::ComputeBigO(
rms
->
complexity
=
result_cpu
.
complexity
;
rms
->
complexity
=
result_cpu
.
complexity
;
}
}
std
::
string
BenchmarkReporter
::
GetBigO
(
BigO
complexity
)
{
switch
(
complexity
)
{
case
oN
:
return
"* N"
;
case
oNSquared
:
return
"* N**2"
;
case
oNCubed
:
return
"* N**3"
;
case
oLogN
:
return
"* lgN"
;
case
oNLogN
:
return
"* NlgN"
;
case
o1
:
return
"* 1"
;
default
:
return
""
;
}
}
TimeUnitMultiplier
BenchmarkReporter
::
GetTimeUnitAndMultiplier
(
TimeUnit
unit
)
{
TimeUnitMultiplier
BenchmarkReporter
::
GetTimeUnitAndMultiplier
(
TimeUnit
unit
)
{
switch
(
unit
)
{
switch
(
unit
)
{
case
kMillisecond
:
case
kMillisecond
:
...
...
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