mirror of
https://github.com/ARM-software/devlib.git
synced 2025-09-07 04:21:54 +01:00
instrument/daq: Use clock boottime for the time column of the energy measurements
92e16ee873
("instrument/daq: Add an explicit time column to the DAQ
measurements") added a time column to the DAQ measurements in order to
help correlate them with those of other collectors like
FtraceCollector. Sadly, FTrace uses CLOCK_BOOTTIME instead of
CLOCK_MONOTONIC by default. CLOCK_MONOTONIC is like CLOCK_BOOTTIME,
except that it stops when the device suspends, which is why I hadn't
spot the issue until now.
Switch to CLOCK_BOOTTIME to get the intended behaviour of the original
commit.
This commit is contained in:
committed by
Marc Bonnici
parent
1381944e5b
commit
a82db5ed37
6
src/get_clock_boottime/Makefile
Normal file
6
src/get_clock_boottime/Makefile
Normal file
@@ -0,0 +1,6 @@
|
||||
CFLAGS=-Wall --pedantic-errors -O2 -static
|
||||
|
||||
all: get_clock_boottime
|
||||
|
||||
get_clock_boottime: get_clock_boottime.c
|
||||
$(CC) $(CFLAGS) $^ -o $@
|
18
src/get_clock_boottime/get_clock_boottime.c
Normal file
18
src/get_clock_boottime/get_clock_boottime.c
Normal file
@@ -0,0 +1,18 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
int main(void) {
|
||||
int ret;
|
||||
struct timespec tp;
|
||||
|
||||
ret = clock_gettime(CLOCK_BOOTTIME, &tp);
|
||||
if (ret) {
|
||||
perror("clock_gettime()");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
printf("%ld.%ld\n", tp.tv_sec, tp.tv_nsec);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
Reference in New Issue
Block a user