1/* 2 * Copyright (c) 2010-2013 Apple Inc. All rights reserved. 3 * 4 * @APPLE_APACHE_LICENSE_HEADER_START@ 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 * 18 * @APPLE_APACHE_LICENSE_HEADER_END@ 19 */ 20 21/* 22 * DTrace Probes for libdispatch 23 * 24 * Only available in the introspection version of the library, 25 * loaded by running a process with the environment variable 26 * DYLD_LIBRARY_PATH=/usr/lib/system/introspection 27 */ 28 29typedef struct dispatch_object_s *dispatch_object_t; 30typedef struct dispatch_queue_s *dispatch_queue_t; 31typedef struct dispatch_source_s *dispatch_source_t; 32typedef void (*dispatch_function_t)(void *); 33typedef struct dispatch_trace_timer_params_s { 34 int64_t deadline, interval, leeway; 35} *dispatch_trace_timer_params_t; 36 37 38provider dispatch { 39 40/* 41 * Probes for dispatch queue push and pop operations 42 * 43 * dispatch$target:libdispatch*.dylib::queue-push 44 * dispatch$target:libdispatch*.dylib::queue-pop 45 */ 46 probe queue__push(dispatch_queue_t queue, const char *label, 47 dispatch_object_t item, const char *kind, 48 dispatch_function_t function, void *context); 49 probe queue__pop(dispatch_queue_t queue, const char *label, 50 dispatch_object_t item, const char *kind, 51 dispatch_function_t function, void *context); 52 53/* 54 * Probes for dispatch callouts to client functions 55 * 56 * dispatch$target:libdispatch*.dylib::callout-entry 57 * dispatch$target:libdispatch*.dylib::callout-return 58 */ 59 probe callout__entry(dispatch_queue_t queue, const char *label, 60 dispatch_function_t function, void *context); 61 probe callout__return(dispatch_queue_t queue, const char *label, 62 dispatch_function_t function, void *context); 63 64/* 65 * Probes for dispatch timer configuration and programming 66 * 67 * Timer configuration indicates that dispatch_source_set_timer() was called. 68 * Timer programming indicates that the dispatch manager is about to sleep 69 * for 'deadline' ns (but may wake up earlier if non-timer events occur). 70 * Time parameters are in nanoseconds, a value of -1 means "forever". 71 * 72 * dispatch$target:libdispatch*.dylib::timer-configure 73 * dispatch$target:libdispatch*.dylib::timer-program 74 */ 75 probe timer__configure(dispatch_source_t source, 76 dispatch_function_t handler, dispatch_trace_timer_params_t params); 77 probe timer__program(dispatch_source_t source, dispatch_function_t handler, 78 dispatch_trace_timer_params_t params); 79 80/* 81 * Probes for dispatch timer wakes and fires 82 * 83 * Timer wakes indicate that the dispatch manager woke up due to expiry of the 84 * deadline for the specified timer. 85 * Timer fires indicate that that the dispatch manager scheduled the event 86 * handler of the specified timer for asynchronous execution (may occur without 87 * a corresponding timer wake if the manager was awake processing other events 88 * when the timer deadline expired). 89 * 90 * dispatch$target:libdispatch*.dylib::timer-wake 91 * dispatch$target:libdispatch*.dylib::timer-fire 92 */ 93 probe timer__wake(dispatch_source_t source, dispatch_function_t handler); 94 probe timer__fire(dispatch_source_t source, dispatch_function_t handler); 95 96}; 97 98 99#pragma D attributes Evolving/Evolving/Common provider dispatch provider 100#pragma D attributes Private/Private/Common provider dispatch module 101#pragma D attributes Private/Private/Common provider dispatch function 102#pragma D attributes Evolving/Evolving/Common provider dispatch name 103#pragma D attributes Evolving/Evolving/Common provider dispatch args 104