1 | /* |
2 | * Copyright (c) 2017 Apple, Inc. All rights reserved. |
3 | * |
4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
5 | * |
6 | * This file contains Original Code and/or Modifications of Original Code |
7 | * as defined in and that are subject to the Apple Public Source License |
8 | * Version 2.0 (the 'License'). You may not use this file except in |
9 | * compliance with the License. The rights granted to you under the License |
10 | * may not be used to create, or enable the creation or redistribution of, |
11 | * unlawful or unlicensed copies of an Apple operating system, or to |
12 | * circumvent, violate, or enable the circumvention or violation of, any |
13 | * terms of an Apple operating system software license agreement. |
14 | * |
15 | * Please obtain a copy of the License at |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. |
17 | * |
18 | * The Original Code and all software distributed under the License are |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
23 | * Please see the License for the specific language governing rights and |
24 | * limitations under the License. |
25 | * |
26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
27 | */ |
28 | |
29 | #ifndef _WORKQUEUE_TRACE_H_ |
30 | #define _WORKQUEUE_TRACE_H_ |
31 | |
32 | // General workqueue tracepoints, mostly for debugging |
33 | #define WQ_TRACE_WORKQUEUE_SUBCLASS 1 |
34 | // Workqueue request scheduling tracepoints |
35 | #define WQ_TRACE_REQUESTS_SUBCLASS 2 |
36 | // Generic pthread tracepoints |
37 | #define WQ_TRACE_BSDTHREAD_SUBCLASS 16 |
38 | |
39 | #define TRACE_wq_pthread_exit \ |
40 | KDBG_CODE(DBG_PTHREAD, WQ_TRACE_WORKQUEUE_SUBCLASS, 0x01) |
41 | #define TRACE_wq_workqueue_exit \ |
42 | KDBG_CODE(DBG_PTHREAD, WQ_TRACE_WORKQUEUE_SUBCLASS, 0x02) |
43 | #define TRACE_wq_runthread \ |
44 | KDBG_CODE(DBG_PTHREAD, WQ_TRACE_WORKQUEUE_SUBCLASS, 0x03) |
45 | #define TRACE_wq_death_call \ |
46 | KDBG_CODE(DBG_PTHREAD, WQ_TRACE_WORKQUEUE_SUBCLASS, 0x05) |
47 | #define TRACE_wq_thread_block \ |
48 | KDBG_CODE(DBG_PTHREAD, WQ_TRACE_WORKQUEUE_SUBCLASS, 0x09) |
49 | #define TRACE_wq_thactive_update \ |
50 | KDBG_CODE(DBG_PTHREAD, WQ_TRACE_WORKQUEUE_SUBCLASS, 0x0a) |
51 | #define TRACE_wq_add_timer \ |
52 | KDBG_CODE(DBG_PTHREAD, WQ_TRACE_WORKQUEUE_SUBCLASS, 0x0b) |
53 | #define TRACE_wq_start_add_timer \ |
54 | KDBG_CODE(DBG_PTHREAD, WQ_TRACE_WORKQUEUE_SUBCLASS, 0x0c) |
55 | #define TRACE_wq_override_dispatch \ |
56 | KDBG_CODE(DBG_PTHREAD, WQ_TRACE_WORKQUEUE_SUBCLASS, 0x14) |
57 | #define TRACE_wq_override_reset \ |
58 | KDBG_CODE(DBG_PTHREAD, WQ_TRACE_WORKQUEUE_SUBCLASS, 0x15) |
59 | #define TRACE_wq_thread_create_failed \ |
60 | KDBG_CODE(DBG_PTHREAD, WQ_TRACE_WORKQUEUE_SUBCLASS, 0x1d) |
61 | #define TRACE_wq_thread_terminate \ |
62 | KDBG_CODE(DBG_PTHREAD, WQ_TRACE_WORKQUEUE_SUBCLASS, 0x1e) |
63 | #define TRACE_wq_thread_create \ |
64 | KDBG_CODE(DBG_PTHREAD, WQ_TRACE_WORKQUEUE_SUBCLASS, 0x1f) |
65 | #define TRACE_wq_select_threadreq \ |
66 | KDBG_CODE(DBG_PTHREAD, WQ_TRACE_WORKQUEUE_SUBCLASS, 0x20) |
67 | #define TRACE_wq_creator_select \ |
68 | KDBG_CODE(DBG_PTHREAD, WQ_TRACE_WORKQUEUE_SUBCLASS, 0x23) |
69 | #define TRACE_wq_creator_yield \ |
70 | KDBG_CODE(DBG_PTHREAD, WQ_TRACE_WORKQUEUE_SUBCLASS, 0x24) |
71 | #define TRACE_wq_constrained_admission \ |
72 | KDBG_CODE(DBG_PTHREAD, WQ_TRACE_WORKQUEUE_SUBCLASS, 0x25) |
73 | #define TRACE_wq_wqops_reqthreads \ |
74 | KDBG_CODE(DBG_PTHREAD, WQ_TRACE_WORKQUEUE_SUBCLASS, 0x26) |
75 | |
76 | #define TRACE_wq_create \ |
77 | KDBG_CODE(DBG_PTHREAD, WQ_TRACE_REQUESTS_SUBCLASS, 0x01) |
78 | #define TRACE_wq_destroy \ |
79 | KDBG_CODE(DBG_PTHREAD, WQ_TRACE_REQUESTS_SUBCLASS, 0x02) |
80 | #define TRACE_wq_thread_logical_run \ |
81 | KDBG_CODE(DBG_PTHREAD, WQ_TRACE_REQUESTS_SUBCLASS, 0x03) |
82 | #define TRACE_wq_thread_request_initiate \ |
83 | KDBG_CODE(DBG_PTHREAD, WQ_TRACE_REQUESTS_SUBCLASS, 0x05) |
84 | #define TRACE_wq_thread_request_modify \ |
85 | KDBG_CODE(DBG_PTHREAD, WQ_TRACE_REQUESTS_SUBCLASS, 0x06) |
86 | #define TRACE_wq_thread_request_fulfill \ |
87 | KDBG_CODE(DBG_PTHREAD, WQ_TRACE_REQUESTS_SUBCLASS, 0x08) |
88 | |
89 | #define TRACE_bsdthread_set_qos_self \ |
90 | KDBG_CODE(DBG_PTHREAD, WQ_TRACE_BSDTHREAD_SUBCLASS, 0x1) |
91 | |
92 | #define WQ_TRACE(x,a,b,c,d,e) \ |
93 | ({ KERNEL_DEBUG_CONSTANT(x, a, b, c, d, e); }) |
94 | #define WQ_TRACE_WQ(x,wq,b,c,d,e) \ |
95 | ({ KERNEL_DEBUG_CONSTANT(x, (wq)->wq_proc->p_pid, b, c, d, e); }) |
96 | |
97 | #if (KDEBUG_LEVEL >= KDEBUG_LEVEL_STANDARD) |
98 | #define __wq_trace_only |
99 | #else // (KDEBUG_LEVEL >= KDEBUG_LEVEL_STANDARD) |
100 | #define __wq_trace_only __unused |
101 | #endif // (KDEBUG_LEVEL >= KDEBUG_LEVEL_STANDARD) |
102 | |
103 | #endif // _WORKQUEUE_TRACE_H_ |
104 | |