BlinkenArea - GitList
Repositories
Blog
Wiki
uproctrace
Code
Commits
Branches
Tags
Search
Tree:
5488c13
Branches
Tags
master
uproctrace
liblwpttr
src
proc_end.c
proc_end: add proc_cpu_time
Stefan Schuermans
commited
5488c13
at 2020-05-17 17:26:39
proc_end.c
Blame
History
Raw
#include <liblwpttr/proc_end.h> #include "cleaner.h" #include "event.h" #include "timing.h" #include <lwproctrace.pb-c.h> #include <stdlib.h> #include <sys/types.h> #include <unistd.h> int lwpttr_proc_end(void **data, size_t *size) { *data = NULL; *size = 0; lwpttr_cleaner_t *cleaner = lwpttr_cleaner_new(); if (! cleaner) { return -1; } struct _Lwproctrace__Timespec timestamp = LWPROCTRACE__TIMESPEC__INIT; timing_get_timestamp(×tamp); struct _Lwproctrace__Timespec proc_cpu_time = LWPROCTRACE__TIMESPEC__INIT; timing_get_proc_cpu_time(&proc_cpu_time); struct _Lwproctrace__ProcEnd proc_end = LWPROCTRACE__PROC_END__INIT; proc_end.pid = getpid(); proc_end.proc_cpu_time = &proc_cpu_time; struct _Lwproctrace__Event event = LWPROCTRACE__EVENT__INIT; event.timestamp = ×tamp; event.proc_end = &proc_end; return lwpttr_event_pack(&event, data, size, cleaner); }