BlinkenArea - GitList
Repositories
Blog
Wiki
uproctrace
Code
Commits
Branches
Tags
Search
Tree:
38f7d8c
Branches
Tags
master
uproctrace
libuptev
src
proc_end.c
rename: lwproctrace -> uproctrace
Stefan Schuermans
commited
38f7d8c
at 2020-05-21 09:57:55
proc_end.c
Blame
History
Raw
#include <uptev/proc_end.h> #include "cleaner.h" #include "event.h" #include "timing.h" #include <uproctrace.pb-c.h> #include <stdlib.h> #include <sys/types.h> #include <unistd.h> int uptev_proc_end(void **data, size_t *size) { *data = NULL; *size = 0; uptev_cleaner_t *cleaner = uptev_cleaner_new(); if (! cleaner) { return -1; } struct _Uproctrace__Timespec timestamp = UPROCTRACE__TIMESPEC__INIT; uptev_timing_get_timestamp(×tamp); struct _Uproctrace__Timespec proc_cpu_time = UPROCTRACE__TIMESPEC__INIT; uptev_timing_get_proc_cpu_time(&proc_cpu_time); struct _Uproctrace__ProcEnd proc_end = UPROCTRACE__PROC_END__INIT; proc_end.pid = getpid(); proc_end.proc_cpu_time = &proc_cpu_time; struct _Uproctrace__Event event = UPROCTRACE__EVENT__INIT; event.timestamp = ×tamp; event.proc_end = &proc_end; return uptev_event_pack(&event, data, size, cleaner); }