X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/316670eb35587141e969394ae8537d66b9211e80..bd504ef0e0b883cdd7917b73b3574eb9ce669905:/osfmk/kern/timer_call.c diff --git a/osfmk/kern/timer_call.c b/osfmk/kern/timer_call.c index 0d737dbbb..5a17e057c 100644 --- a/osfmk/kern/timer_call.c +++ b/osfmk/kern/timer_call.c @@ -40,7 +40,7 @@ #include -#if CONFIG_DTRACE && (DEVELOPMENT || DEBUG ) +#if CONFIG_DTRACE #include #endif @@ -358,6 +358,15 @@ timer_call_enter_internal( call->soft_deadline = deadline; } #endif + call->ttd = call->soft_deadline - ctime; + +#if CONFIG_DTRACE + DTRACE_TMR6(callout__create, timer_call_func_t, CE(call)->func, + timer_call_param_t, CE(call)->param0, uint32_t, call->flags, + (deadline - call->soft_deadline), + (call->ttd >> 32), (unsigned) (call->ttd & 0xFFFFFFFF)); +#endif + queue = timer_queue_assign(deadline); old_queue = timer_call_enqueue_deadline_unlocked(call, queue, deadline); @@ -409,6 +418,12 @@ timer_call_cancel( } splx(s); +#if CONFIG_DTRACE + DTRACE_TMR6(callout__cancel, timer_call_func_t, CE(call)->func, + timer_call_param_t, CE(call)->param0, uint32_t, call->flags, 0, + (call->ttd >> 32), (unsigned) (call->ttd & 0xFFFFFFFF)); +#endif + return (old_queue != NULL); } @@ -499,18 +514,25 @@ timer_queue_expire( DECR_TIMER_CALLOUT | DBG_FUNC_START, VM_KERNEL_UNSLIDE(func), param0, param1, 0, 0); -#if CONFIG_DTRACE && (DEVELOPMENT || DEBUG ) - DTRACE_TMR3(callout__start, timer_call_func_t, func, - timer_call_param_t, param0, - timer_call_param_t, param1); +#if CONFIG_DTRACE + DTRACE_TMR6(callout__start, timer_call_func_t, func, + timer_call_param_t, param0, unsigned, call->flags, + 0, (call->ttd >> 32), + (unsigned) (call->ttd & 0xFFFFFFFF)); #endif + /* Maintain time-to-deadline in per-processor data + * structure for thread wakeup deadline statistics. + */ + uint64_t *ttdp = &(PROCESSOR_DATA(current_processor(), timer_call_ttd)); + *ttdp = call->ttd; (*func)(param0, param1); + *ttdp = 0; -#if CONFIG_DTRACE && (DEVELOPMENT || DEBUG ) - DTRACE_TMR3(callout__end, timer_call_func_t, func, - timer_call_param_t, param0, - timer_call_param_t, param1); +#if CONFIG_DTRACE + DTRACE_TMR3(callout__end, timer_call_func_t, func, + timer_call_param_t, param0, timer_call_param_t, + param1); #endif KERNEL_DEBUG_CONSTANT_IST(KDEBUG_TRACE,