Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LEFEBVREJP email
radix
Commits
7743ea0f
Commit
7743ea0f
authored
Jan 14, 2018
by
LEFEBVREJP email
Browse files
Merge branch 'timer_upgrade' into 'master'
Adding wall_clock and sum_wall_clock to radix::Timer. See merge request
!21
parents
c73f0616
21574249
Pipeline
#11514
failed with stage
in 3 minutes and 29 seconds
Changes
2
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
radixbug/bug.hh
View file @
7743ea0f
...
...
@@ -184,6 +184,22 @@ class Timer
return
mDuration
.
count
();
}
size_t
intervals
()
const
{
return
mIntervals
;
}
double
wall_clock
()
{
radix_require
(
!
mRunning
);
// 1e9 nanoseconds in a second
using
seconds
=
std
::
chrono
::
duration
<
double
,
std
::
ratio
<
1000
,
1
>>
;
return
seconds
(
mEnd
-
mStart
).
count
();
}
double
sum_wall_clock
()
{
// 1e9 nanoseconds in a second
using
seconds
=
std
::
chrono
::
duration
<
double
,
std
::
ratio
<
1000
,
1
>>
;
return
seconds
(
mDuration
).
count
();
}
};
// class Timer
}
// namespace radix
...
...
radixbug/tests/tstBug.cc
View file @
7743ea0f
...
...
@@ -44,4 +44,6 @@ TEST(radixbug, Timer)
std
::
chrono
::
seconds
second
((
42300
*
3
));
// 1.5 days
using
days
=
std
::
chrono
::
duration
<
float
,
std
::
ratio
<
84600
,
1
>>
;
std
::
cout
<<
"Days: "
<<
days
(
second
).
count
()
<<
std
::
endl
;
std
::
cout
<<
"Wall clock (s): "
<<
timer1
.
wall_clock
()
<<
std
::
endl
;
std
::
cout
<<
"Sum wall clock (s): "
<<
timer1
.
sum_wall_clock
()
<<
std
::
endl
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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