Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F63745048
timers.h
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, May 22, 05:33
Size
1 KB
Mime Type
text/x-c++
Expires
Fri, May 24, 05:33 (2 d)
Engine
blob
Format
Raw Data
Handle
17813346
Attached To
R12667 gbench-stream
timers.h
View Options
#ifndef BENCHMARK_TIMERS_H
#define BENCHMARK_TIMERS_H
#include <chrono>
#include <string>
namespace
benchmark
{
// Return the CPU usage of the current process
double
ProcessCPUUsage
();
// Return the CPU usage of the children of the current process
double
ChildrenCPUUsage
();
// Return the CPU usage of the current thread
double
ThreadCPUUsage
();
#if defined(HAVE_STEADY_CLOCK)
template
<
bool
HighResIsSteady
=
std
::
chrono
::
high_resolution_clock
::
is_steady
>
struct
ChooseSteadyClock
{
typedef
std
::
chrono
::
high_resolution_clock
type
;
};
template
<>
struct
ChooseSteadyClock
<
false
>
{
typedef
std
::
chrono
::
steady_clock
type
;
};
#endif
struct
ChooseClockType
{
#if defined(HAVE_STEADY_CLOCK)
typedef
ChooseSteadyClock
<>::
type
type
;
#else
typedef
std
::
chrono
::
high_resolution_clock
type
;
#endif
};
inline
double
ChronoClockNow
()
{
typedef
ChooseClockType
::
type
ClockType
;
using
FpSeconds
=
std
::
chrono
::
duration
<
double
,
std
::
chrono
::
seconds
::
period
>
;
return
FpSeconds
(
ClockType
::
now
().
time_since_epoch
()).
count
();
}
std
::
string
LocalDateTimeString
();
}
// end namespace benchmark
#endif
// BENCHMARK_TIMERS_H
Event Timeline
Log In to Comment