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
b57b2cfd
Commit
b57b2cfd
authored
May 01, 2017
by
Joao Paulo Magalhaes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve some comments.
parent
64b5f3ff
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
10 deletions
+7
-10
output_test.h
test/output_test.h
+5
-8
output_test_helper.cc
test/output_test_helper.cc
+2
-2
No files found.
test/output_test.h
View file @
b57b2cfd
...
@@ -78,18 +78,15 @@ void RunOutputTests(int argc, char* argv[]);
...
@@ -78,18 +78,15 @@ void RunOutputTests(int argc, char* argv[]);
struct
Results
;
struct
Results
;
typedef
std
::
function
<
void
(
Results
const
&
)
>
ResultsCheckFn
;
typedef
std
::
function
<
void
(
Results
const
&
)
>
ResultsCheckFn
;
// Add a function to check the (CSV) results of a benchmark. These
// functions will be called only after the output was successfully
// checked.
// bm_name_pattern: a name or a regex which will be matched agains
// all the benchmark names. Matching benchmarks
// will be the subject of a call to fn
size_t
AddChecker
(
const
char
*
bm_name_pattern
,
ResultsCheckFn
fn
);
size_t
AddChecker
(
const
char
*
bm_name_pattern
,
ResultsCheckFn
fn
);
// Class
to hold the (CSV!)
results of a benchmark.
// Class
holding the
results of a benchmark.
// It is passed in calls to checker functions.
// It is passed in calls to checker functions.
struct
Results
{
struct
Results
{
std
::
string
name
;
// the benchmark name
// the benchmark name
std
::
string
name
;
// the benchmark fields
std
::
map
<
std
::
string
,
std
::
string
>
values
;
std
::
map
<
std
::
string
,
std
::
string
>
values
;
Results
(
const
std
::
string
&
n
)
:
name
(
n
)
{}
Results
(
const
std
::
string
&
n
)
:
name
(
n
)
{}
...
...
test/output_test_helper.cc
View file @
b57b2cfd
...
@@ -247,11 +247,11 @@ void ResultsChecker::SetHeader_(const std::string& csv_header) {
...
@@ -247,11 +247,11 @@ void ResultsChecker::SetHeader_(const std::string& csv_header) {
field_names
=
SplitCsv_
(
csv_header
);
field_names
=
SplitCsv_
(
csv_header
);
}
}
// set the values for
subscribed benchmarks, and silently ignore all others
// set the values for
a benchmark
void
ResultsChecker
::
SetValues_
(
const
std
::
string
&
entry_csv_line
)
{
void
ResultsChecker
::
SetValues_
(
const
std
::
string
&
entry_csv_line
)
{
if
(
entry_csv_line
.
empty
())
return
;
// some lines are empty
CHECK
(
!
field_names
.
empty
());
CHECK
(
!
field_names
.
empty
());
auto
vals
=
SplitCsv_
(
entry_csv_line
);
auto
vals
=
SplitCsv_
(
entry_csv_line
);
if
(
vals
.
empty
())
return
;
CHECK_EQ
(
vals
.
size
(),
field_names
.
size
());
CHECK_EQ
(
vals
.
size
(),
field_names
.
size
());
results
.
emplace_back
(
vals
[
0
]);
// vals[0] is the benchmark name
results
.
emplace_back
(
vals
[
0
]);
// vals[0] is the benchmark name
auto
&
entry
=
results
.
back
();
auto
&
entry
=
results
.
back
();
...
...
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