The times() syscall retrieves the running times of the current process and of given child processes. Upon successful completion, the buf argument, if it is not NULL, is filled with an array of struct tms values.
A struct tms value has the following form:
structtms{clock_ttms_utime;// user timeclock_ttms_stime;// system timeclock_ttms_cutime;// user time of process and child processesclock_ttms_cstime;// system time of process and child processes};
The clock_t type is an arithmetic type which is capable of representing times.
This syscall is useful for profiling applications or to measure their running time. It can also be used to get an idea of the time a process and its children spent in user and system mode.
The times() syscall can be used in the following example to get more insight into a process and child processes running times:
structtmst;if(times(&t)!=-1){printf("User time of this process: %lld ms\n",t.tms_utime*MSEC_PER_SEC);printf("System time of this process: %lld ms\n",t.tms_stime*MSEC_PER_SEC);printf("User time of this process and its childrens: %lld ms\n",t.tms_cutime*MSEC_PER_SEC);printf("System time of this process and its childrens: %lld ms\n",t.tms_cstime*MSEC_PER_SEC);}
This document was automatically generated by OpenAI and needs review. It might
not be accurate and might contain errors. The authors of Tracee recommend that
the user reads the "events.go" source file to understand the events and their
arguments better.