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
1003a70e
Commit
1003a70e
authored
May 24, 2016
by
Eric Fiselier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix csv_reporter when reporting errors
parent
6f84ffcd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
4 deletions
+26
-4
csv_reporter.cc
src/csv_reporter.cc
+26
-4
No files found.
src/csv_reporter.cc
View file @
1003a70e
...
...
@@ -28,6 +28,21 @@
namespace
benchmark
{
namespace
{
std
::
vector
<
std
::
string
>
elements
=
{
"name"
,
"iterations"
,
"real_time"
,
"cpu_time"
,
"time_unit"
,
"bytes_per_second"
,
"items_per_second"
,
"label"
,
"error_occurred"
,
"error_message"
};
}
bool
CSVReporter
::
ReportContext
(
const
Context
&
context
)
{
std
::
cerr
<<
"Run on ("
<<
context
.
num_cpus
<<
" X "
<<
context
.
mhz_per_cpu
<<
" MHz CPU "
<<
((
context
.
num_cpus
>
1
)
?
"s"
:
""
)
<<
")
\n
"
;
...
...
@@ -44,8 +59,12 @@ bool CSVReporter::ReportContext(const Context& context) {
std
::
cerr
<<
"***WARNING*** Library was built as DEBUG. Timings may be "
"affected.
\n
"
;
#endif
std
::
cout
<<
"name,iterations,real_time,cpu_time,time_unit,bytes_per_second,"
"items_per_second,label
\n
"
;
for
(
auto
B
=
elements
.
begin
();
B
!=
elements
.
end
();
)
{
std
::
cout
<<
*
B
++
;
if
(
B
!=
elements
.
end
())
std
::
cout
<<
","
;
}
std
::
cout
<<
"
\n
"
;
return
true
;
}
...
...
@@ -95,10 +114,12 @@ void CSVReporter::PrintRunData(const Run & run) {
ReplaceAll
(
&
name
,
"
\"
"
,
"
\"\"
"
);
std
::
cout
<<
'"'
<<
name
<<
"
\"
,"
;
if
(
run
.
error_occurred
)
{
std
::
cout
<<
"error_occurred,"
;
std
::
cout
<<
std
::
string
(
elements
.
size
()
-
3
,
','
);
std
::
cout
<<
"true,"
;
std
::
string
msg
=
run
.
error_message
;
ReplaceAll
(
&
msg
,
"
\"
"
,
"
\"\"
"
);
std
::
cout
<<
'"'
<<
msg
<<
"
\"
,"
;
std
::
cout
<<
'"'
<<
msg
<<
"
\"\n
"
;
return
;
}
double
multiplier
;
...
...
@@ -142,6 +163,7 @@ void CSVReporter::PrintRunData(const Run & run) {
ReplaceAll
(
&
label
,
"
\"
"
,
"
\"\"
"
);
std
::
cout
<<
"
\"
"
<<
label
<<
"
\"
"
;
}
std
::
cout
<<
",,"
;
// for error_occurred and error_message
std
::
cout
<<
'\n'
;
}
...
...
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