2 * Copyright (c) 2010-2013 Apple Inc. All rights reserved.
4 * @APPLE_APACHE_LICENSE_HEADER_START@
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @APPLE_APACHE_LICENSE_HEADER_END@
22 * DTrace Probes for libdispatch
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
29 typedef struct dispatch_object_s *dispatch_object_t;
30 typedef struct dispatch_queue_s *dispatch_queue_t;
31 typedef struct dispatch_source_s *dispatch_source_t;
32 typedef void (*dispatch_function_t)(void *);
33 typedef struct dispatch_trace_timer_params_s {
34 int64_t deadline, interval, leeway;
35 } *dispatch_trace_timer_params_t;
41 * Probes for dispatch queue push and pop operations
43 * dispatch$target:libdispatch*.dylib::queue-push
44 * dispatch$target:libdispatch*.dylib::queue-pop
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);
54 * Probes for dispatch callouts to client functions
56 * dispatch$target:libdispatch*.dylib::callout-entry
57 * dispatch$target:libdispatch*.dylib::callout-return
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);
65 * Probes for dispatch timer configuration and programming
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".
72 * dispatch$target:libdispatch*.dylib::timer-configure
73 * dispatch$target:libdispatch*.dylib::timer-program
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);
81 * Probes for dispatch timer wakes and fires
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).
90 * dispatch$target:libdispatch*.dylib::timer-wake
91 * dispatch$target:libdispatch*.dylib::timer-fire
93 probe timer__wake(dispatch_source_t source, dispatch_function_t handler);
94 probe timer__fire(dispatch_source_t source, dispatch_function_t handler);
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
105 typedef struct voucher_s *voucher_t;
108 * Probes for vouchers
115 * voucher$target:::create A new voucher is being created
116 * voucher$target:::dispose A voucher is being freed
117 * voucher$target:::retain A voucher is being retained
118 * voucher$target:::release A voucher is being released
120 probe create(voucher_t voucher, mach_port_t kv, uint64_t activity_id);
121 probe dispose(voucher_t voucher);
122 probe retain(voucher_t voucher, int resulting_refcnt);
123 probe release(voucher_t voucher, int resulting_refcnt);
128 * voucher$target:::adopt A voucher is being adopted by the current thread
129 * voucher$target:::orphan A voucher is being orphanned by the current thread
131 probe adopt(voucher_t voucher);
132 probe orphan(voucher_t voucher);
136 #pragma D attributes Evolving/Evolving/Common provider voucher provider
137 #pragma D attributes Private/Private/Common provider voucher module
138 #pragma D attributes Private/Private/Common provider voucher function
139 #pragma D attributes Evolving/Evolving/Common provider voucher name
140 #pragma D attributes Evolving/Evolving/Common provider voucher args