BlinkenArea - GitList
Repositories
Blog
Wiki
uproctrace
Code
Commits
Branches
Tags
Search
Tree:
5488c13
Branches
Tags
master
uproctrace
liblwpttr
src
timing.c
proc_end: add proc_cpu_time
Stefan Schuermans
commited
5488c13
at 2020-05-17 17:26:39
timing.c
Blame
History
Raw
#include "timing.h" #include <lwproctrace.pb-c.h> #include <time.h> static void timing_clock_gettime(clockid_t clockid, struct _Lwproctrace__Timespec *tsp) { struct timespec ts; clock_gettime(clockid, &ts); tsp->sec = ts.tv_sec; tsp->has_nsec = 1; tsp->nsec = ts.tv_nsec; } void timing_get_timestamp(struct _Lwproctrace__Timespec *timestamp) { timing_clock_gettime(CLOCK_REALTIME, timestamp); } void timing_get_proc_cpu_time(struct _Lwproctrace__Timespec *proc_cpu_time) { timing_clock_gettime(CLOCK_PROCESS_CPUTIME_ID, proc_cpu_time); }