void ktrace_disable(enum ktrace_state state_to_match) { if (ktrace_state == state_to_match) { kernel_debug_disable(); kperf_sampling_disable(); } }
void kperf_reset(void) { lck_mtx_assert(ktrace_lock, LCK_MTX_ASSERT_OWNED); /* turn off sampling first */ (void)kperf_sampling_disable(); /* cleanup miscellaneous configuration first */ (void)kperf_kdbg_cswitch_set(0); (void)kperf_set_lightweight_pet(0); kperf_kdebug_reset(); /* timers, which require actions, first */ kperf_timer_reset(); kperf_action_reset(); }
static int sysctl_sampling( struct sysctl_oid *oidp, struct sysctl_req *req ) { int error = 0; uint32_t value = 0; /* get the old value and process it */ value = kperf_sampling_status(); /* copy out the old value, get the new value */ error = sysctl_handle_int(oidp, &value, 0, req); if (error || !req->newptr) return (error); /* if that worked, and we're writing... */ if( value ) error = kperf_sampling_enable(); else error = kperf_sampling_disable(); return error; }