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
44c25c89
Commit
44c25c89
authored
Oct 21, 2016
by
Dominic Hamon
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'mkurdej-fix-time-unit'
parents
57a22c69
8aeb20f1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
2 deletions
+28
-2
complexity.cc
src/complexity.cc
+2
-0
output_test_helper.cc
test/output_test_helper.cc
+3
-1
reporter_output_test.cc
test/reporter_output_test.cc
+23
-1
No files found.
src/complexity.cc
View file @
44c25c89
...
@@ -195,6 +195,7 @@ std::vector<BenchmarkReporter::Run> ComputeStats(
...
@@ -195,6 +195,7 @@ std::vector<BenchmarkReporter::Run> ComputeStats(
cpu_accumulated_time_stat
.
Mean
()
*
run_iterations
;
cpu_accumulated_time_stat
.
Mean
()
*
run_iterations
;
mean_data
.
bytes_per_second
=
bytes_per_second_stat
.
Mean
();
mean_data
.
bytes_per_second
=
bytes_per_second_stat
.
Mean
();
mean_data
.
items_per_second
=
items_per_second_stat
.
Mean
();
mean_data
.
items_per_second
=
items_per_second_stat
.
Mean
();
mean_data
.
time_unit
=
reports
[
0
].
time_unit
;
// Only add label to mean/stddev if it is same for all runs
// Only add label to mean/stddev if it is same for all runs
mean_data
.
report_label
=
reports
[
0
].
report_label
;
mean_data
.
report_label
=
reports
[
0
].
report_label
;
...
@@ -213,6 +214,7 @@ std::vector<BenchmarkReporter::Run> ComputeStats(
...
@@ -213,6 +214,7 @@ std::vector<BenchmarkReporter::Run> ComputeStats(
stddev_data
.
cpu_accumulated_time
=
cpu_accumulated_time_stat
.
StdDev
();
stddev_data
.
cpu_accumulated_time
=
cpu_accumulated_time_stat
.
StdDev
();
stddev_data
.
bytes_per_second
=
bytes_per_second_stat
.
StdDev
();
stddev_data
.
bytes_per_second
=
bytes_per_second_stat
.
StdDev
();
stddev_data
.
items_per_second
=
items_per_second_stat
.
StdDev
();
stddev_data
.
items_per_second
=
items_per_second_stat
.
StdDev
();
stddev_data
.
time_unit
=
reports
[
0
].
time_unit
;
results
.
push_back
(
mean_data
);
results
.
push_back
(
mean_data
);
results
.
push_back
(
stddev_data
);
results
.
push_back
(
stddev_data
);
...
...
test/output_test_helper.cc
View file @
44c25c89
...
@@ -38,7 +38,9 @@ SubMap& GetSubstitutions() {
...
@@ -38,7 +38,9 @@ SubMap& GetSubstitutions() {
{
" %s "
,
"[ ]+"
},
{
" %s "
,
"[ ]+"
},
{
"%time"
,
"[ ]*[0-9]{1,5} ns"
},
{
"%time"
,
"[ ]*[0-9]{1,5} ns"
},
{
"%console_report"
,
"[ ]*[0-9]{1,5} ns [ ]*[0-9]{1,5} ns [ ]*[0-9]+"
},
{
"%console_report"
,
"[ ]*[0-9]{1,5} ns [ ]*[0-9]{1,5} ns [ ]*[0-9]+"
},
{
"%csv_report"
,
"[0-9]+,"
+
dec_re
+
","
+
dec_re
+
",ns,,,,,"
}};
{
"%console_us_report"
,
"[ ]*[0-9] us [ ]*[0-9] us [ ]*[0-9]+"
},
{
"%csv_report"
,
"[0-9]+,"
+
dec_re
+
","
+
dec_re
+
",ns,,,,,"
},
{
"%csv_us_report"
,
"[0-9]+,"
+
dec_re
+
","
+
dec_re
+
",us,,,,,"
}};
return
map
;
return
map
;
}
}
...
...
test/reporter_output_test.cc
View file @
44c25c89
...
@@ -120,8 +120,30 @@ ADD_CASES(TC_CSVOut, {{".*BM_SummaryRepeat/repeats:3 ", MR_Not},
...
@@ -120,8 +120,30 @@ ADD_CASES(TC_CSVOut, {{".*BM_SummaryRepeat/repeats:3 ", MR_Not},
{
"^
\"
BM_SummaryRepeat/repeats:3_mean
\"
,%csv_report$"
},
{
"^
\"
BM_SummaryRepeat/repeats:3_mean
\"
,%csv_report$"
},
{
"^
\"
BM_SummaryRepeat/repeats:3_stddev
\"
,%csv_report$"
}});
{
"^
\"
BM_SummaryRepeat/repeats:3_stddev
\"
,%csv_report$"
}});
void
BM_RepeatTimeUnit
(
benchmark
::
State
&
state
)
{
while
(
state
.
KeepRunning
())
{
}
}
BENCHMARK
(
BM_RepeatTimeUnit
)
->
Repetitions
(
3
)
->
ReportAggregatesOnly
()
->
Unit
(
benchmark
::
kMicrosecond
);
ADD_CASES
(
TC_ConsoleOut
,
{{
".*BM_RepeatTimeUnit/repeats:3 "
,
MR_Not
},
{
"^BM_RepeatTimeUnit/repeats:3_mean %console_us_report$"
},
{
"^BM_RepeatTimeUnit/repeats:3_stddev %console_us_report$"
}});
ADD_CASES
(
TC_JSONOut
,
{{
".*BM_RepeatTimeUnit/repeats:3 "
,
MR_Not
},
{
"
\"
name
\"
:
\"
BM_RepeatTimeUnit/repeats:3_mean
\"
,$"
},
{
"
\"
time_unit
\"
:
\"
us
\"
,?$"
},
{
"
\"
name
\"
:
\"
BM_RepeatTimeUnit/repeats:3_stddev
\"
,$"
},
{
"
\"
time_unit
\"
:
\"
us
\"
,?$"
}});
ADD_CASES
(
TC_CSVOut
,
{{
".*BM_RepeatTimeUnit/repeats:3 "
,
MR_Not
},
{
"^
\"
BM_RepeatTimeUnit/repeats:3_mean
\"
,%csv_us_report$"
},
{
"^
\"
BM_RepeatTimeUnit/repeats:3_stddev
\"
,%csv_us_report$"
}});
// ========================================================================= //
// ========================================================================= //
// --------------------------- TEST CASES END ------------------------------ //
// --------------------------- TEST CASES END ------------------------------ //
// ========================================================================= //
// ========================================================================= //
int
main
(
int
argc
,
char
*
argv
[])
{
RunOutputTests
(
argc
,
argv
);
}
int
main
(
int
argc
,
char
*
argv
[])
{
RunOutputTests
(
argc
,
argv
);
}
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