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
1826feb1
Commit
1826feb1
authored
Apr 28, 2017
by
Joao Paulo Magalhaes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ResultsCheckerEntry: add more getter functions.
parent
2a8d0dd1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
3 deletions
+39
-3
output_test.h
test/output_test.h
+39
-3
No files found.
test/output_test.h
View file @
1826feb1
...
@@ -73,9 +73,26 @@ struct ResultsCheckerEntry {
...
@@ -73,9 +73,26 @@ struct ResultsCheckerEntry {
std
::
map
<
std
::
string
,
std
::
string
>
values
;
std
::
map
<
std
::
string
,
std
::
string
>
values
;
ResultsCheckFn
check_fn
;
ResultsCheckFn
check_fn
;
// int NumThreads() const; // TODO
int
NumThreads
()
const
{
// double duration_real_time() const {} // TODO
auto
pos
=
name
.
find_last_of
(
"/threads:"
);
// double duration_cpu_time() const {} // TODO
if
(
pos
==
name
.
npos
)
return
1
;
auto
end
=
name
.
find_last_of
(
'/'
,
pos
+
9
);
std
::
stringstream
ss
;
ss
<<
name
.
substr
(
pos
+
9
,
end
);
int
num
=
1
;
ss
>>
num
;
CHECK
(
!
ss
.
fail
());
return
num
;
}
// get the real_time duration of the benchmark in seconds
double
DurationRealTime
()
const
{
return
GetAs
<
double
>
(
"iterations"
)
*
GetTime
(
"real_time"
);
}
// get the cpu_time duration of the benchmark in seconds
double
DurationCPUTime
()
const
{
return
GetAs
<
double
>
(
"iterations"
)
*
GetTime
(
"cpu_time"
);
}
// get the string for a result by name, or nullptr if the name
// get the string for a result by name, or nullptr if the name
// is not found
// is not found
...
@@ -105,6 +122,25 @@ struct ResultsCheckerEntry {
...
@@ -105,6 +122,25 @@ struct ResultsCheckerEntry {
T
tval
=
static_cast
<
T
>
(
dval
);
T
tval
=
static_cast
<
T
>
(
dval
);
return
tval
;
return
tval
;
}
}
// get cpu_time or real_time in seconds
double
GetTime
(
const
char
*
which
)
const
{
double
val
=
GetAs
<
double
>
(
which
);
auto
unit
=
Get
(
"time_unit"
);
CHECK
(
unit
);
if
(
*
unit
==
"ns"
)
{
return
val
*
1.e-9
;
}
else
if
(
*
unit
==
"us"
)
{
return
val
*
1.e-6
;
}
else
if
(
*
unit
==
"ms"
)
{
return
val
*
1.e-3
;
}
else
if
(
*
unit
==
"s"
)
{
return
val
;
}
else
{
CHECK
(
1
==
0
)
<<
"unknown time unit: "
<<
*
unit
;
return
0
;
}
}
};
};
#define _CHECK_RESULT_VALUE(entry, getfn, var_type, var_name, relationship, value) \
#define _CHECK_RESULT_VALUE(entry, getfn, var_type, var_name, relationship, value) \
...
...
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