osfmk/man/etap_trace_event.html
System Trap - manipulate event probes and lock event tracing.
**#include<mach/etap.h>**** kern\_return\_t etap\_trace\_event****(etap\_data\_t**mode, **mode** type, **boolean\_t** enable, **enable** nargs, **mode** mode**);**
modeindicates the desired trace flavor or reset option and may be one, or more, of the following:
ETAP_RESET: reset mode, clears all trace status and cumulative buffer entries
typeused when measuring lock event contention or durations and may be one, or more, of the following:
ETAP_DURATION
enablea boolean value indicattin whether the event trace operation is to be enabled (TRUE) or disabled (FALSE).
nargsspecifies how many arguments are passed in the args array.
argsan array, each element of which is a character string representing a specific subsystem or event type. These values must correspond to the ones the kernel uses to represent the same subsystems and event types. The maximum length of a character string is EVENT_NAME_LENGTH (defined in mach/etap.h ).
The etap_trace_event system call is used to enable and disable kernel event probes (of a specified type) and all modes of lock event tracing. The call also supports a reset option, where the cumulative buffer data and all event type tracing is reset to zero. When the reset option is used, a new interval width can also be defined, using the nargs parameter.
To reset the ETAP instrumentation, the system call would utilize the mode parameter, passing the value of ETAP_RESET (All other parameters may equal NULL). If, at the time of reset, the nargs parameter is assigned a value, then the cumulative buffer interval width will be adjusted to be the size of that value. For example, the following system call would reset the ETAP instrumentation and adjust the cumulative buffer's interval width to 100ms:
etap_trace_event(ETAP_RESET, 0, 0, 100, 0);
KERN_SUCCESS The call was performed successfully.
KERN_NO_SPACE A shortage of kernel resources prevented the operation from completing; the kernel has cleaned up all residual state (the error indicates a "clean" failure).
KERN_FAILURE ETAP is not configured in the kernel.
Functions: etap_probe, etap_trace_thread, etap_get_info.