]> git.saurik.com Git - apple/xnu.git/blame - osfmk/kern/telemetry.h
xnu-7195.60.75.tar.gz
[apple/xnu.git] / osfmk / kern / telemetry.h
CommitLineData
1c79356b 1/*
39236c6e 2 * Copyright (c) 2012-2013 Apple Inc. All rights reserved.
5d5c5d0d 3 *
2d21ac55 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
0a7de745 5 *
2d21ac55
A
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.
0a7de745 14 *
2d21ac55
A
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
0a7de745 17 *
2d21ac55
A
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
8f6c56a5
A
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2d21ac55
A
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.
0a7de745 25 *
2d21ac55 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
1c79356b 27 */
1c79356b 28
39236c6e
A
29#ifndef _KERNEL_TELEMETRY_H_
30#define _KERNEL_TELEMETRY_H_
1c79356b 31
39236c6e 32#include <stdint.h>
fe8ab488 33#include <sys/cdefs.h>
39236c6e
A
34#include <mach/mach_types.h>
35#include <kern/thread.h>
1c79356b 36
fe8ab488
A
37__BEGIN_DECLS
38
d9a64523
A
39#define TELEMETRY_CMD_TIMER_EVENT 1
40#define TELEMETRY_CMD_VOUCHER_NAME 2
41#define TELEMETRY_CMD_VOUCHER_STAIN TELEMETRY_CMD_VOUCHER_NAME
42
43enum telemetry_pmi {
44 TELEMETRY_PMI_NONE,
45 TELEMETRY_PMI_INSTRS,
46 TELEMETRY_PMI_CYCLES,
47};
48#define TELEMETRY_CMD_PMI_SETUP 3
49
50#if XNU_KERNEL_PRIVATE
51
39236c6e 52extern volatile boolean_t telemetry_needs_record;
1c79356b 53
39236c6e 54extern void telemetry_init(void);
1c79356b 55
39236c6e 56extern void compute_telemetry(void *);
1c79356b 57
5ba3f43e 58extern void telemetry_ast(thread_t thread, uint32_t reasons);
1c79356b 59
39236c6e
A
60extern int telemetry_gather(user_addr_t buffer, uint32_t *length, boolean_t mark);
61
d9a64523 62extern void telemetry_mark_curthread(boolean_t interrupted_userspace,
0a7de745 63 boolean_t pmi);
39236c6e
A
64
65extern void telemetry_task_ctl(task_t task, uint32_t reason, int enable_disable);
66extern void telemetry_task_ctl_locked(task_t task, uint32_t reason, int enable_disable);
67extern void telemetry_global_ctl(int enable_disable);
68
69extern int telemetry_timer_event(uint64_t deadline, uint64_t interval, uint64_t leeway);
d9a64523 70extern int telemetry_pmi_setup(enum telemetry_pmi pmi_type, uint64_t interval);
39236c6e
A
71
72extern void bootprofile_init(void);
fe8ab488 73extern void bootprofile_wake_from_sleep(void);
39037602 74extern void bootprofile_get(void **buffer, uint32_t *length);
39236c6e 75extern int bootprofile_gather(user_addr_t buffer, uint32_t *length);
1c79356b 76
d9a64523
A
77#endif /* XNU_KERNEL_PRIVATE */
78
fe8ab488
A
79__END_DECLS
80
39236c6e 81#endif /* _KERNEL_TELEMETRY_H_ */