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
47226ccd
Commit
47226ccd
authored
May 01, 2017
by
Joao Paulo Magalhaes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CHECK(): rename EPS to FLOAT for consistency with googletest style.
parent
2a2eb44b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
21 deletions
+21
-21
check.h
src/check.h
+6
-6
output_test.h
test/output_test.h
+8
-8
user_counters_test.cc
test/user_counters_test.cc
+7
-7
No files found.
src/check.h
View file @
47226ccd
...
...
@@ -69,11 +69,11 @@ class CheckHandler {
#define CHECK_GT(a, b) CHECK((a) > (b))
#define CHECK_LT(a, b) CHECK((a) < (b))
#define CHECK_
EQ_EPS
(a, b, eps) CHECK(std::fabs((a) - (b)) < (eps))
#define CHECK_
NE_EPS
(a, b, eps) CHECK(std::fabs((a) - (b)) >= (eps))
#define CHECK_
GE_EPS
(a, b, eps) CHECK((a) - (b) > -(eps))
#define CHECK_
LE_EPS
(a, b, eps) CHECK((b) - (a) > -(eps))
#define CHECK_
GT_EPS
(a, b, eps) CHECK((a) - (b) > (eps))
#define CHECK_
LT_EPS
(a, b, eps) CHECK((b) - (a) > (eps))
#define CHECK_
FLOAT_EQ
(a, b, eps) CHECK(std::fabs((a) - (b)) < (eps))
#define CHECK_
FLOAT_NE
(a, b, eps) CHECK(std::fabs((a) - (b)) >= (eps))
#define CHECK_
FLOAT_GE
(a, b, eps) CHECK((a) - (b) > -(eps))
#define CHECK_
FLOAT_LE
(a, b, eps) CHECK((b) - (a) > -(eps))
#define CHECK_
FLOAT_GT
(a, b, eps) CHECK((a) - (b) > (eps))
#define CHECK_
FLOAT_LT
(a, b, eps) CHECK((b) - (a) > (eps))
#endif // CHECK_H_
test/output_test.h
View file @
47226ccd
...
...
@@ -145,10 +145,10 @@ T Results::GetAs(const char* entry_name) const {
<< "=" << (entry).getfn< var_type >(var_name) \
<< " to be " #relationship " to " << (value) << "\n"
// check with tolerance. eps_factor is the tolerance window, which
will be
// interpreted relative to value.
#define _CHECK_
RESULT_VALUE_EPS
(entry, getfn, var_type, var_name, relationship, value, eps_factor) \
CONCAT(CHECK_
, relationship)
\
// check with tolerance. eps_factor is the tolerance window, which
is
// interpreted relative to value
(eg, 0.1 means 10% of value)
.
#define _CHECK_
FLOAT_RESULT_VALUE
(entry, getfn, var_type, var_name, relationship, value, eps_factor) \
CONCAT(CHECK_
FLOAT_, relationship)
\
(entry.getfn< var_type >(var_name), (value), (eps_factor) * (value)) << "\n" \
<< __FILE__ << ":" << __LINE__ << ": " << (entry).name << ":\n" \
<< __FILE__ << ":" << __LINE__ << ": " \
...
...
@@ -170,11 +170,11 @@ T Results::GetAs(const char* entry_name) const {
#define CHECK_COUNTER_VALUE(entry, var_type, var_name, relationship, value) \
_CHECK_RESULT_VALUE(entry, GetCounterAs, var_type, var_name, relationship, value)
#define CHECK_
RESULT_VALUE_EPS
(entry, var_name, relationship, value, eps_factor) \
_CHECK_
RESULT_VALUE_EPS
(entry, GetAs, double, var_name, relationship, value, eps_factor)
#define CHECK_
FLOAT_RESULT_VALUE
(entry, var_name, relationship, value, eps_factor) \
_CHECK_
FLOAT_RESULT_VALUE
(entry, GetAs, double, var_name, relationship, value, eps_factor)
#define CHECK_
COUNTER_VALUE_EPS
(entry, var_name, relationship, value, eps_factor) \
_CHECK_
RESULT_VALUE_EPS
(entry, GetCounterAs, double, var_name, relationship, value, eps_factor)
#define CHECK_
FLOAT_COUNTER_VALUE
(entry, var_name, relationship, value, eps_factor) \
_CHECK_
FLOAT_RESULT_VALUE
(entry, GetCounterAs, double, var_name, relationship, value, eps_factor)
#define CHECK_BENCHMARK_RESULTS(bm_name, checker_function) \
size_t CONCAT(dummy, __LINE__) = AddChecker(bm_name, checker_function)
...
...
test/user_counters_test.cc
View file @
47226ccd
...
...
@@ -41,7 +41,7 @@ void CheckSimple(Results const& e) {
double
its
=
e
.
GetAs
<
double
>
(
"iterations"
);
CHECK_COUNTER_VALUE
(
e
,
int
,
"foo"
,
EQ
,
1
);
// check that the value of bar is within 0.1% of the expected value
CHECK_
COUNTER_VALUE_EPS
(
e
,
"bar"
,
EQ_EPS
,
2.
*
its
,
0.001
);
CHECK_
FLOAT_COUNTER_VALUE
(
e
,
"bar"
,
EQ
,
2.
*
its
,
0.001
);
}
CHECK_BENCHMARK_RESULTS
(
"BM_Counters_Simple"
,
&
CheckSimple
);
...
...
@@ -81,8 +81,8 @@ void CheckBytesAndItemsPSec(Results const& e) {
CHECK_COUNTER_VALUE
(
e
,
int
,
"foo"
,
EQ
,
1
);
CHECK_COUNTER_VALUE
(
e
,
int
,
"bar"
,
EQ
,
num_calls1
);
// check that the values are within 0.1% of the expected values
CHECK_
RESULT_VALUE_EPS
(
e
,
"bytes_per_second"
,
EQ_EPS
,
364.
/
t
,
0.001
);
CHECK_
RESULT_VALUE_EPS
(
e
,
"items_per_second"
,
EQ_EPS
,
150.
/
t
,
0.001
);
CHECK_
FLOAT_RESULT_VALUE
(
e
,
"bytes_per_second"
,
EQ
,
364.
/
t
,
0.001
);
CHECK_
FLOAT_RESULT_VALUE
(
e
,
"items_per_second"
,
EQ
,
150.
/
t
,
0.001
);
}
CHECK_BENCHMARK_RESULTS
(
"BM_Counters_WithBytesAndItemsPSec"
,
&
CheckBytesAndItemsPSec
);
...
...
@@ -114,8 +114,8 @@ ADD_CASES(TC_CSVOut, {{"^\"BM_Counters_Rate\",%csv_report,%float,%float$"}});
void
CheckRate
(
Results
const
&
e
)
{
double
t
=
e
.
DurationCPUTime
();
// this (and not real time) is the time used
// check that the values are within 0.1% of the expected values
CHECK_
COUNTER_VALUE_EPS
(
e
,
"foo"
,
EQ_EPS
,
1.
/
t
,
0.001
);
CHECK_
COUNTER_VALUE_EPS
(
e
,
"bar"
,
EQ_EPS
,
2.
/
t
,
0.001
);
CHECK_
FLOAT_COUNTER_VALUE
(
e
,
"foo"
,
EQ
,
1.
/
t
,
0.001
);
CHECK_
FLOAT_COUNTER_VALUE
(
e
,
"bar"
,
EQ
,
2.
/
t
,
0.001
);
}
CHECK_BENCHMARK_RESULTS
(
"BM_Counters_Rate"
,
&
CheckRate
);
...
...
@@ -204,8 +204,8 @@ ADD_CASES(TC_CSVOut, {{"^\"BM_Counters_AvgThreadsRate/threads:%int\",%csv_report
// VS2013 does not allow this function to be passed as a lambda argument
// to CHECK_BENCHMARK_RESULTS()
void
CheckAvgThreadsRate
(
Results
const
&
e
)
{
CHECK_
COUNTER_VALUE_EPS
(
e
,
"foo"
,
EQ_EPS
,
1.
/
e
.
DurationCPUTime
(),
0.001
);
CHECK_
COUNTER_VALUE_EPS
(
e
,
"bar"
,
EQ_EPS
,
2.
/
e
.
DurationCPUTime
(),
0.001
);
CHECK_
FLOAT_COUNTER_VALUE
(
e
,
"foo"
,
EQ
,
1.
/
e
.
DurationCPUTime
(),
0.001
);
CHECK_
FLOAT_COUNTER_VALUE
(
e
,
"bar"
,
EQ
,
2.
/
e
.
DurationCPUTime
(),
0.001
);
}
CHECK_BENCHMARK_RESULTS
(
"BM_Counters_AvgThreadsRate/threads:%int"
,
&
CheckAvgThreadsRate
);
...
...
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