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