clock_getres¶
Intro¶
clock_getres - This system call knows the resolution (precision) of the specified clock, i.e. the period between successive readings.
Description¶
The clock_getres
system call gets current clock resolution for the specified clock.
It returns the resolution of the clock, that is, how often clock periods occur.
It is expressed in seconds and nanoseconds. It is allowed for the target of the res
argument to be NULL.
In this case, the resolution is not returned though the system call does succeed.
One advantage of using this system call instead of other system calls to measure time is that it provides an accurate enough resolution to measure even small chunks of time. As such, it is widely used in benchmarking and performance testing applications. A potential drawback of using this system call to measure time is that the resolution of the clock is based on the system, so the accuracy of the measurement may vary across different system configurations.
Arguments¶
clockid
:const clockid_t
- The clock ID to get the resolution of.res
:struct timespec*
[K] - Pointer to a timespec structure filled by the kernel with the resolution of the clock.
Available Tags¶
- K - Originated from kernel-space.
Hooks¶
sys_clock_getres¶
Type¶
Kprobe + Kretprobe
Purpose¶
Hooking the sys_clock_getres
function allows us to properly measure the time of execution of the clock_getres
system call.
Example Use Case¶
The clock_getres
system call can be used in performance tests or benchmarking applications
in order to accurately measure the time spent in certain parts of the code.
Issues¶
No known issues.
Related Events¶
- clock_gettime
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.