]> git.saurik.com Git - apple/xnu.git/blame - osfmk/kperf/thread_samplers.h
xnu-7195.101.1.tar.gz
[apple/xnu.git] / osfmk / kperf / thread_samplers.h
CommitLineData
39037602
A
1/*
2 * Copyright (c) 2011 Apple Computer, 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 KPERF_THREAD_SAMPLERS_H
30#define KPERF_THREAD_SAMPLERS_H
31
32#include <kperf/context.h>
33
34/* legacy thread info */
35struct kperf_thread_info {
36 uint64_t kpthi_pid;
37 uint64_t kpthi_tid;
38 uint64_t kpthi_dq_addr;
39 uint64_t kpthi_runmode;
40};
41
42void kperf_thread_info_sample(struct kperf_thread_info *,
0a7de745 43 struct kperf_context *);
39037602
A
44void kperf_thread_info_log(struct kperf_thread_info *);
45
cb323159
A
46// legacy names
47#define kpthsc_requested_qos_ipc_override kpthsc_requested_qos_kevent_override
48
39037602
A
49/* scheduling information */
50struct kperf_thread_scheduling {
51 uint64_t kpthsc_user_time;
52 uint64_t kpthsc_system_time;
d9a64523 53 uint64_t kpthsc_runnable_time;
39037602
A
54 unsigned int kpthsc_state;
55 uint16_t kpthsc_base_priority;
56 uint16_t kpthsc_sched_priority;
5ba3f43e 57 unsigned int kpthsc_effective_qos :3,
0a7de745
A
58 kpthsc_requested_qos :3,
59 kpthsc_requested_qos_override :3,
60 kpthsc_requested_qos_promote :3,
cb323159
A
61 kpthsc_requested_qos_kevent_override :3,
62 kpthsc_requested_qos_sync_ipc_override :3, /* obsolete */
0a7de745 63 kpthsc_effective_latency_qos :3;
39037602
A
64};
65
66void kperf_thread_scheduling_sample(struct kperf_thread_scheduling *,
0a7de745 67 struct kperf_context *);
39037602
A
68void kperf_thread_scheduling_log(struct kperf_thread_scheduling *);
69
70/* thread snapshot information */
71struct kperf_thread_snapshot {
72 uint64_t kpthsn_last_made_runnable_time;
73 int16_t kpthsn_suspend_count;
74 uint8_t kpthsn_io_tier;
75 uint8_t kpthsn_flags;
76};
77
78void kperf_thread_snapshot_sample(struct kperf_thread_snapshot *,
0a7de745 79 struct kperf_context *);
39037602
A
80void kperf_thread_snapshot_log(struct kperf_thread_snapshot *);
81
82/* libdispatch information */
83struct kperf_thread_dispatch {
84 uint64_t kpthdi_dq_serialno;
85};
86
87void kperf_thread_dispatch_sample(struct kperf_thread_dispatch *,
0a7de745 88 struct kperf_context *);
94ff46dc 89int kperf_thread_dispatch_pend(struct kperf_context *, unsigned int actionid);
39037602
A
90void kperf_thread_dispatch_log(struct kperf_thread_dispatch *);
91
5ba3f43e
A
92void kperf_thread_inscyc_log(struct kperf_context *);
93
39037602 94#endif /* !defined(KPERF_THREAD_SAMPLERS_H) */