]> git.saurik.com Git - apple/xnu.git/blob - osfmk/kern/etap_pool.h
xnu-517.7.7.tar.gz
[apple/xnu.git] / osfmk / kern / etap_pool.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 /*
23 * @OSF_COPYRIGHT@
24 *
25 */
26 /*
27 * HISTORY
28 *
29 * Revision 1.1.1.1 1998/09/22 21:05:34 wsanchez
30 * Import of Mac OS X kernel (~semeria)
31 *
32 * Revision 1.1.1.1 1998/03/07 02:25:54 wsanchez
33 * Import of OSF Mach kernel (~mburg)
34 *
35 * Revision 1.1.2.4 1995/10/09 17:13:55 devrcs
36 * Merged RT3_SHARED version into `mainline.'
37 * [1995/09/13 16:17:31 joe]
38 *
39 * Revision 1.1.2.3 1995/09/18 19:13:40 devrcs
40 * Merged RT3_SHARED version into `mainline.'
41 * [1995/09/13 16:17:31 joe]
42 *
43 * Revision 1.1.2.2 1995/01/10 05:11:19 devrcs
44 * mk6 CR801 - new file for mk6_shared from cnmk_shared.
45 * [1994/12/01 21:11:51 dwm]
46 *
47 * Revision 1.1.2.1 1994/10/21 18:28:53 joe
48 * Initial ETAP submission
49 * [1994/10/20 19:31:35 joe]
50 *
51 * $EndLog$
52 */
53 /*
54 * File : etap_pool.h
55 *
56 * The start_data_node structure is primarily needed to hold
57 * start information for read locks (since multiple readers
58 * can acquire a read lock). For consistency, however, the
59 * structure is used for write locks as well. Each complex
60 * lock will maintain a linked list of these structures.
61 */
62
63 #ifndef _KERN_ETAP_POOL_H_
64 #define _KERN_ETAP_POOL_H_
65
66 #include <kern/etap_options.h>
67 #include <mach/etap.h>
68 #include <mach/boolean.h>
69
70 #if ETAP_LOCK_TRACE
71
72 #include <cpus.h>
73 #include <mach/clock_types.h>
74 #include <mach/kern_return.h>
75 #include <kern/misc_protos.h>
76
77 struct start_data_node {
78 unsigned int thread_id; /* thread id */
79 etap_time_t start_hold_time; /* time of last acquisition */
80 etap_time_t start_wait_time; /* time of first miss */
81 unsigned int start_pc; /* pc of acquiring function */
82 unsigned int end_pc; /* pc of relinquishing function */
83 struct start_data_node *next; /* pointer to next list entry */
84 };
85
86 typedef struct start_data_node* start_data_node_t;
87
88 /*
89 * The start_data_node pool is statically
90 * allocated and privatly maintained
91 */
92
93 #define SD_POOL_ENTRIES (NCPUS * 256)
94
95 extern void init_start_data_pool(void);
96 extern start_data_node_t get_start_data_node(void);
97 extern void free_start_data_node(start_data_node_t);
98
99 #else /* ETAP_LOCK_TRACE */
100 typedef boolean_t start_data_node_t;
101 #define get_start_data_node()
102 #define free_start_start_data_node(node)
103 #endif /* ETAP_LOCK_TRACE */
104
105 #define SD_ENTRY_NULL ((start_data_node_t) 0)
106
107 #endif /* _KERN_ETAP_POOL_H_ */