]> git.saurik.com Git - apple/xnu.git/blame - bsd/pthread/workqueue_trace.h
xnu-6153.141.1.tar.gz
[apple/xnu.git] / bsd / pthread / workqueue_trace.h
CommitLineData
d9a64523
A
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 \
0a7de745 40 KDBG_CODE(DBG_PTHREAD, WQ_TRACE_WORKQUEUE_SUBCLASS, 0x01)
d9a64523 41#define TRACE_wq_workqueue_exit \
0a7de745 42 KDBG_CODE(DBG_PTHREAD, WQ_TRACE_WORKQUEUE_SUBCLASS, 0x02)
d9a64523 43#define TRACE_wq_runthread \
0a7de745 44 KDBG_CODE(DBG_PTHREAD, WQ_TRACE_WORKQUEUE_SUBCLASS, 0x03)
d9a64523 45#define TRACE_wq_death_call \
0a7de745 46 KDBG_CODE(DBG_PTHREAD, WQ_TRACE_WORKQUEUE_SUBCLASS, 0x05)
d9a64523 47#define TRACE_wq_thread_block \
0a7de745 48 KDBG_CODE(DBG_PTHREAD, WQ_TRACE_WORKQUEUE_SUBCLASS, 0x09)
d9a64523 49#define TRACE_wq_thactive_update \
0a7de745 50 KDBG_CODE(DBG_PTHREAD, WQ_TRACE_WORKQUEUE_SUBCLASS, 0x0a)
d9a64523 51#define TRACE_wq_add_timer \
0a7de745 52 KDBG_CODE(DBG_PTHREAD, WQ_TRACE_WORKQUEUE_SUBCLASS, 0x0b)
d9a64523 53#define TRACE_wq_start_add_timer \
0a7de745 54 KDBG_CODE(DBG_PTHREAD, WQ_TRACE_WORKQUEUE_SUBCLASS, 0x0c)
d9a64523 55#define TRACE_wq_override_dispatch \
0a7de745 56 KDBG_CODE(DBG_PTHREAD, WQ_TRACE_WORKQUEUE_SUBCLASS, 0x14)
d9a64523 57#define TRACE_wq_override_reset \
0a7de745 58 KDBG_CODE(DBG_PTHREAD, WQ_TRACE_WORKQUEUE_SUBCLASS, 0x15)
d9a64523 59#define TRACE_wq_thread_create_failed \
0a7de745 60 KDBG_CODE(DBG_PTHREAD, WQ_TRACE_WORKQUEUE_SUBCLASS, 0x1d)
d9a64523 61#define TRACE_wq_thread_terminate \
0a7de745 62 KDBG_CODE(DBG_PTHREAD, WQ_TRACE_WORKQUEUE_SUBCLASS, 0x1e)
d9a64523 63#define TRACE_wq_thread_create \
0a7de745 64 KDBG_CODE(DBG_PTHREAD, WQ_TRACE_WORKQUEUE_SUBCLASS, 0x1f)
d9a64523 65#define TRACE_wq_select_threadreq \
0a7de745 66 KDBG_CODE(DBG_PTHREAD, WQ_TRACE_WORKQUEUE_SUBCLASS, 0x20)
d9a64523 67#define TRACE_wq_creator_select \
0a7de745 68 KDBG_CODE(DBG_PTHREAD, WQ_TRACE_WORKQUEUE_SUBCLASS, 0x23)
d9a64523 69#define TRACE_wq_creator_yield \
0a7de745 70 KDBG_CODE(DBG_PTHREAD, WQ_TRACE_WORKQUEUE_SUBCLASS, 0x24)
d9a64523 71#define TRACE_wq_constrained_admission \
0a7de745 72 KDBG_CODE(DBG_PTHREAD, WQ_TRACE_WORKQUEUE_SUBCLASS, 0x25)
d9a64523 73#define TRACE_wq_wqops_reqthreads \
0a7de745 74 KDBG_CODE(DBG_PTHREAD, WQ_TRACE_WORKQUEUE_SUBCLASS, 0x26)
d9a64523
A
75
76#define TRACE_wq_create \
0a7de745 77 KDBG_CODE(DBG_PTHREAD, WQ_TRACE_REQUESTS_SUBCLASS, 0x01)
d9a64523 78#define TRACE_wq_destroy \
0a7de745 79 KDBG_CODE(DBG_PTHREAD, WQ_TRACE_REQUESTS_SUBCLASS, 0x02)
d9a64523 80#define TRACE_wq_thread_logical_run \
0a7de745 81 KDBG_CODE(DBG_PTHREAD, WQ_TRACE_REQUESTS_SUBCLASS, 0x03)
d9a64523 82#define TRACE_wq_thread_request_initiate \
0a7de745 83 KDBG_CODE(DBG_PTHREAD, WQ_TRACE_REQUESTS_SUBCLASS, 0x05)
d9a64523 84#define TRACE_wq_thread_request_modify \
0a7de745 85 KDBG_CODE(DBG_PTHREAD, WQ_TRACE_REQUESTS_SUBCLASS, 0x06)
d9a64523 86#define TRACE_wq_thread_request_fulfill \
0a7de745 87 KDBG_CODE(DBG_PTHREAD, WQ_TRACE_REQUESTS_SUBCLASS, 0x08)
d9a64523
A
88
89#define TRACE_bsdthread_set_qos_self \
0a7de745 90 KDBG_CODE(DBG_PTHREAD, WQ_TRACE_BSDTHREAD_SUBCLASS, 0x1)
d9a64523 91
0a7de745
A
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); })
d9a64523
A
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_