]>
git.saurik.com Git - apple/xnu.git/blob - bsd/sys/pgo.h
2 * Copyright (c) 2014 Apple Computer, Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
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.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
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.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
32 #include <sys/_types.h>
33 #include <sys/_types/_ssize_t.h>
35 #include <uuid/uuid.h>
38 #define PGO_WAIT_FOR_UNLOAD (2)
39 #define PGO_METADATA (4)
40 #define PGO_RESET_ALL (8)
42 #define PGO_ALL_FLAGS (PGO_HIB | PGO_WAIT_FOR_UNLOAD | PGO_METADATA | PGO_RESET_ALL)
46 * This is a serialization format for metadata related to a profile data buffer.
48 * If metadata is present, this footer will appear at the end of the file, so
49 * the last four bytes of the file will be the ASCII string "meta".
51 * The metadata is stored in a environment-string style buffer. The buffer
52 * consists of key-value pairs, which are delimited by null bytes. Each
53 * key-value pair is a string of the form "FOO=bar". Everything before the
54 * first equal sign is the key, everything after is the value.
56 * All members are in network byte order.
58 struct pgo_metadata_footer
{
62 * This should be htonl(n), where n is the number of key-value pairs in the
65 uint32_t number_of_pairs
;
68 * pointer to the metadata buffer
70 * This should be htonl(offset), where offset is the backwards offset from
71 * the end of the file to the metadata buffer.
73 uint32_t offset_to_pairs
;
78 * This should be htonl(0x6d657461);
85 ssize_t
grab_pgo_data(
88 unsigned char *buffer
,
94 #ifdef XNU_KERNEL_PRIVATE
95 kern_return_t
do_pgo_reset_counters(void);