mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-10 07:00:53 +00:00
clock: prefer clock monotonic
Various articles claim that CLOCK_MONOTONIC is actually faster than the CLOCK_MONOTONIC_RAW, and that seems to be my experience.
This commit is contained in:
@ -24,18 +24,17 @@ void
|
|||||||
sp_clock_init (void)
|
sp_clock_init (void)
|
||||||
{
|
{
|
||||||
static const gint clock_ids[] = {
|
static const gint clock_ids[] = {
|
||||||
|
CLOCK_MONOTONIC,
|
||||||
CLOCK_MONOTONIC_RAW,
|
CLOCK_MONOTONIC_RAW,
|
||||||
CLOCK_MONOTONIC_COARSE,
|
CLOCK_MONOTONIC_COARSE,
|
||||||
CLOCK_MONOTONIC,
|
|
||||||
CLOCK_REALTIME_COARSE,
|
CLOCK_REALTIME_COARSE,
|
||||||
CLOCK_REALTIME,
|
CLOCK_REALTIME,
|
||||||
};
|
};
|
||||||
guint i;
|
|
||||||
|
|
||||||
if (sp_clock != -1)
|
if (sp_clock != -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (clock_ids); i++)
|
for (guint i = 0; i < G_N_ELEMENTS (clock_ids); i++)
|
||||||
{
|
{
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
int clock_id = clock_ids [i];
|
int clock_id = clock_ids [i];
|
||||||
|
|||||||
Reference in New Issue
Block a user