2 * Copyright (c) 2010 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@
29 #ifndef _IOKIT_STATISTICS_H
30 #define _IOKIT_STATISTICS_H
32 #define IOSTATISTICS_SIG 'IOST'
33 #define IOSTATISTICS_SIG_USERCLIENT 'IOSU'
34 #define IOSTATISTICS_SIG_WORKLOOP 'IOSW'
36 /* Update when the binary format changes */
37 #define IOSTATISTICS_VER 0x2
40 kIOStatisticsDriverNameLength
= 64,
41 kIOStatisticsClassNameLength
= 64,
42 kIOStatisticsProcessNameLength
= 20
46 kIOStatisticsDerivedEventSourceCounter
= 0,
47 kIOStatisticsTimerEventSourceCounter
,
48 kIOStatisticsCommandGateCounter
,
49 kIOStatisticsCommandQueueCounter
,
50 kIOStatisticsInterruptEventSourceCounter
,
51 kIOStatisticsFilterInterruptEventSourceCounter
54 typedef uint32_t IOStatisticsCounterType
;
57 kIOStatisticsGeneral
= 0,
58 kIOStatisticsWorkLoop
,
59 kIOStatisticsUserClient
62 /* Keep our alignments as intended */
68 typedef struct IOStatisticsInterruptEventSources
{
71 uint32_t checksForWork
;
72 } IOStatisticsInterruptEventSources
;
74 typedef struct IOStatisticsTimerEventSources
{
76 uint32_t openGateCalls
;
77 uint32_t closeGateCalls
;
80 uint32_t checksForWork
;
81 } IOStatisticsTimerEventSources
;
83 typedef struct IOStatisticsDerivedEventSources
{
85 uint32_t openGateCalls
;
86 uint32_t closeGateCalls
;
88 } IOStatisticsDerivedEventSources
;
90 typedef struct IOStatisticsCommandGates
{
92 uint32_t openGateCalls
;
93 uint32_t closeGateCalls
;
96 } IOStatisticsCommandGates
;
98 typedef struct IOStatisticsCommandQueues
{
100 uint32_t actionCalls
;
101 } IOStatisticsCommandQueues
;
103 typedef struct IOStatisticsUserClients
{
105 uint32_t clientCalls
;
106 } IOStatisticsUserClients
;
110 typedef struct IOStatisticsHeader
{
111 uint32_t sig
; /* 'IOST' */
112 uint32_t ver
; /* incremented with every data revision */
114 uint32_t seq
; /* sequence ID */
116 uint32_t globalStatsOffset
;
117 uint32_t kextStatsOffset
;
118 uint32_t memoryStatsOffset
;
119 uint32_t classStatsOffset
;
120 uint32_t counterStatsOffset
;
121 uint32_t kextIdentifiersOffset
;
122 uint32_t classNamesOffset
;
124 /* struct IOStatisticsGlobal */
125 /* struct IOStatisticsKext */
126 /* struct IOStatisticsMemory */
127 /* struct IOStatisticsClass */
128 /* struct IOStatisticsCounter */
129 /* struct IOStatisticsKextIdentifier */
130 /* struct IOStatisticsClassName */
131 } IOStatisticsHeader
;
133 typedef struct IOStatisticsGlobal
{
137 } IOStatisticsGlobal
;
139 typedef struct IOStatisticsKext
{
143 uint32_t classes
; /* Number of classes owned */
144 uint32_t classIndexes
[]; /* Variable length array of owned class indexes */
147 typedef struct IOStatisticsMemory
{
148 uint32_t allocatedSize
;
150 uint32_t allocatedAlignedSize
;
151 uint32_t freedAlignedSize
;
152 uint32_t allocatedContiguousSize
;
153 uint32_t freedContiguousSize
;
154 uint32_t allocatedPageableSize
;
155 uint32_t freedPageableSize
;
156 } IOStatisticsMemory
;
158 typedef struct IOStatisticsClass
{
160 uint32_t superClassID
;
164 typedef struct IOStatisticsCounter
{
166 uint32_t classInstanceCount
;
167 struct IOStatisticsUserClients userClientStatistics
;
168 struct IOStatisticsInterruptEventSources interruptEventSourceStatistics
;
169 struct IOStatisticsInterruptEventSources filterInterruptEventSourceStatistics
;
170 struct IOStatisticsTimerEventSources timerEventSourceStatistics
;
171 struct IOStatisticsCommandGates commandGateStatistics
;
172 struct IOStatisticsCommandQueues commandQueueStatistics
;
173 struct IOStatisticsDerivedEventSources derivedEventSourceStatistics
;
174 } IOStatisticsCounter
;
176 typedef struct IOStatisticsKextIdentifier
{
177 char identifier
[kIOStatisticsDriverNameLength
];
178 } IOStatisticsKextIdentifier
;
180 typedef struct IOStatisticsClassName
{
181 char name
[kIOStatisticsClassNameLength
];
182 } IOStatisticsClassName
;
186 typedef struct IOStatisticsWorkLoop
{
187 uint32_t attachedEventSources
;
189 uint32_t kextLoadTag
;
190 uint32_t dependentKexts
;
191 uint32_t dependentKextLoadTags
[];
192 } IOStatisticsWorkLoop
;
194 typedef struct IOStatisticsWorkLoopHeader
{
195 uint32_t sig
; /* 'IOSW */
196 uint32_t ver
; /* incremented with every data revision */
197 uint32_t seq
; /* sequence ID */
198 uint32_t workloopCount
;
199 struct IOStatisticsWorkLoop workLoopStats
;
200 } IOStatisticsWorkLoopHeader
;
202 /* UserClient mode */
204 typedef struct IOStatisticsUserClientCall
{
205 char processName
[kIOStatisticsProcessNameLength
];
208 } IOStatisticsUserClientCall
;
210 typedef struct IOStatisticsUserClientHeader
{
211 uint32_t sig
; /* 'IOSU */
212 uint32_t ver
; /* incremented with every data revision */
213 uint32_t seq
; /* sequence ID */
215 struct IOStatisticsUserClientCall userClientCalls
[];
216 } IOStatisticsUserClientHeader
;
220 #endif /* _IOKIT_STATISTICS_H */