1 | /** @file
|
---|
2 | * STAM - Statistics Manager.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2015 Oracle Corporation
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef ___VBox_vmm_stam_h
|
---|
27 | #define ___VBox_vmm_stam_h
|
---|
28 |
|
---|
29 | #include <VBox/types.h>
|
---|
30 | #include <iprt/stdarg.h>
|
---|
31 | #ifdef _MSC_VER
|
---|
32 | # if _MSC_VER >= 1400
|
---|
33 | # include <intrin.h>
|
---|
34 | # endif
|
---|
35 | #endif
|
---|
36 |
|
---|
37 | RT_C_DECLS_BEGIN
|
---|
38 |
|
---|
39 | /** @defgroup grp_stam The Statistics Manager API
|
---|
40 | * @{
|
---|
41 | */
|
---|
42 |
|
---|
43 | #if defined(VBOX_WITHOUT_RELEASE_STATISTICS) && defined(VBOX_WITH_STATISTICS)
|
---|
44 | # error "Both VBOX_WITHOUT_RELEASE_STATISTICS and VBOX_WITH_STATISTICS are defined! Make up your mind!"
|
---|
45 | #endif
|
---|
46 |
|
---|
47 |
|
---|
48 | /** @def STAM_GET_TS
|
---|
49 | * Gets the CPU timestamp counter.
|
---|
50 | *
|
---|
51 | * @param u64 The 64-bit variable which the timestamp shall be saved in.
|
---|
52 | */
|
---|
53 | #ifdef __GNUC__
|
---|
54 | # if defined(RT_ARCH_X86)
|
---|
55 | /* This produces optimal assembler code for x86 but does not work for AMD64 ('A' means 'either rax or rdx') */
|
---|
56 | # define STAM_GET_TS(u64) __asm__ __volatile__ ("rdtsc\n\t" : "=A" (u64))
|
---|
57 | # elif defined(RT_ARCH_AMD64)
|
---|
58 | # define STAM_GET_TS(u64) \
|
---|
59 | do { uint64_t low; uint64_t high; \
|
---|
60 | __asm__ __volatile__ ("rdtsc\n\t" : "=a"(low), "=d"(high)); \
|
---|
61 | (u64) = ((high << 32) | low); \
|
---|
62 | } while (0)
|
---|
63 | # endif
|
---|
64 | #else
|
---|
65 | # if _MSC_VER >= 1400
|
---|
66 | # pragma intrinsic(__rdtsc)
|
---|
67 | # define STAM_GET_TS(u64) \
|
---|
68 | do { (u64) = __rdtsc(); } while (0)
|
---|
69 | # else
|
---|
70 | # define STAM_GET_TS(u64) \
|
---|
71 | do { \
|
---|
72 | uint64_t u64Tmp; \
|
---|
73 | __asm { \
|
---|
74 | __asm rdtsc \
|
---|
75 | __asm mov dword ptr [u64Tmp], eax \
|
---|
76 | __asm mov dword ptr [u64Tmp + 4], edx \
|
---|
77 | } \
|
---|
78 | (u64) = u64Tmp; \
|
---|
79 | } while (0)
|
---|
80 | # endif
|
---|
81 | #endif
|
---|
82 |
|
---|
83 |
|
---|
84 | /** @def STAM_REL_STATS
|
---|
85 | * Code for inclusion only when VBOX_WITH_STATISTICS is defined.
|
---|
86 | * @param code A code block enclosed in {}.
|
---|
87 | */
|
---|
88 | #ifndef VBOX_WITHOUT_RELEASE_STATISTICS
|
---|
89 | # define STAM_REL_STATS(code) do code while(0)
|
---|
90 | #else
|
---|
91 | # define STAM_REL_STATS(code) do {} while(0)
|
---|
92 | #endif
|
---|
93 | /** @def STAM_STATS
|
---|
94 | * Code for inclusion only when VBOX_WITH_STATISTICS is defined.
|
---|
95 | * @param code A code block enclosed in {}.
|
---|
96 | */
|
---|
97 | #ifdef VBOX_WITH_STATISTICS
|
---|
98 | # define STAM_STATS(code) STAM_REL_STATS(code)
|
---|
99 | #else
|
---|
100 | # define STAM_STATS(code) do {} while(0)
|
---|
101 | #endif
|
---|
102 |
|
---|
103 |
|
---|
104 | /**
|
---|
105 | * Sample type.
|
---|
106 | */
|
---|
107 | typedef enum STAMTYPE
|
---|
108 | {
|
---|
109 | /** Invalid entry. */
|
---|
110 | STAMTYPE_INVALID = 0,
|
---|
111 | /** Generic counter. */
|
---|
112 | STAMTYPE_COUNTER,
|
---|
113 | /** Profiling of an function. */
|
---|
114 | STAMTYPE_PROFILE,
|
---|
115 | /** Profiling of an operation. */
|
---|
116 | STAMTYPE_PROFILE_ADV,
|
---|
117 | /** Ratio of A to B, uint32_t types. Not reset. */
|
---|
118 | STAMTYPE_RATIO_U32,
|
---|
119 | /** Ratio of A to B, uint32_t types. Reset both to 0. */
|
---|
120 | STAMTYPE_RATIO_U32_RESET,
|
---|
121 | /** Callback. */
|
---|
122 | STAMTYPE_CALLBACK,
|
---|
123 | /** Generic unsigned 8-bit value. Not reset. */
|
---|
124 | STAMTYPE_U8,
|
---|
125 | /** Generic unsigned 8-bit value. Reset to 0. */
|
---|
126 | STAMTYPE_U8_RESET,
|
---|
127 | /** Generic hexadecimal unsigned 8-bit value. Not reset. */
|
---|
128 | STAMTYPE_X8,
|
---|
129 | /** Generic hexadecimal unsigned 8-bit value. Reset to 0. */
|
---|
130 | STAMTYPE_X8_RESET,
|
---|
131 | /** Generic unsigned 16-bit value. Not reset. */
|
---|
132 | STAMTYPE_U16,
|
---|
133 | /** Generic unsigned 16-bit value. Reset to 0. */
|
---|
134 | STAMTYPE_U16_RESET,
|
---|
135 | /** Generic hexadecimal unsigned 16-bit value. Not reset. */
|
---|
136 | STAMTYPE_X16,
|
---|
137 | /** Generic hexadecimal unsigned 16-bit value. Reset to 0. */
|
---|
138 | STAMTYPE_X16_RESET,
|
---|
139 | /** Generic unsigned 32-bit value. Not reset. */
|
---|
140 | STAMTYPE_U32,
|
---|
141 | /** Generic unsigned 32-bit value. Reset to 0. */
|
---|
142 | STAMTYPE_U32_RESET,
|
---|
143 | /** Generic hexadecimal unsigned 32-bit value. Not reset. */
|
---|
144 | STAMTYPE_X32,
|
---|
145 | /** Generic hexadecimal unsigned 32-bit value. Reset to 0. */
|
---|
146 | STAMTYPE_X32_RESET,
|
---|
147 | /** Generic unsigned 64-bit value. Not reset. */
|
---|
148 | STAMTYPE_U64,
|
---|
149 | /** Generic unsigned 64-bit value. Reset to 0. */
|
---|
150 | STAMTYPE_U64_RESET,
|
---|
151 | /** Generic hexadecimal unsigned 64-bit value. Not reset. */
|
---|
152 | STAMTYPE_X64,
|
---|
153 | /** Generic hexadecimal unsigned 64-bit value. Reset to 0. */
|
---|
154 | STAMTYPE_X64_RESET,
|
---|
155 | /** Generic boolean value. Not reset. */
|
---|
156 | STAMTYPE_BOOL,
|
---|
157 | /** Generic boolean value. Reset to false. */
|
---|
158 | STAMTYPE_BOOL_RESET,
|
---|
159 | /** The end (exclusive). */
|
---|
160 | STAMTYPE_END
|
---|
161 | } STAMTYPE;
|
---|
162 |
|
---|
163 | /**
|
---|
164 | * Sample visibility type.
|
---|
165 | */
|
---|
166 | typedef enum STAMVISIBILITY
|
---|
167 | {
|
---|
168 | /** Invalid entry. */
|
---|
169 | STAMVISIBILITY_INVALID = 0,
|
---|
170 | /** Always visible. */
|
---|
171 | STAMVISIBILITY_ALWAYS,
|
---|
172 | /** Only visible when used (/hit). */
|
---|
173 | STAMVISIBILITY_USED,
|
---|
174 | /** Not visible in the GUI. */
|
---|
175 | STAMVISIBILITY_NOT_GUI,
|
---|
176 | /** The end (exclusive). */
|
---|
177 | STAMVISIBILITY_END
|
---|
178 | } STAMVISIBILITY;
|
---|
179 |
|
---|
180 | /**
|
---|
181 | * Sample unit.
|
---|
182 | */
|
---|
183 | typedef enum STAMUNIT
|
---|
184 | {
|
---|
185 | /** Invalid entry .*/
|
---|
186 | STAMUNIT_INVALID = 0,
|
---|
187 | /** No unit. */
|
---|
188 | STAMUNIT_NONE,
|
---|
189 | /** Number of calls. */
|
---|
190 | STAMUNIT_CALLS,
|
---|
191 | /** Count of whatever. */
|
---|
192 | STAMUNIT_COUNT,
|
---|
193 | /** Count of bytes. */
|
---|
194 | STAMUNIT_BYTES,
|
---|
195 | /** Count of bytes. */
|
---|
196 | STAMUNIT_PAGES,
|
---|
197 | /** Error count. */
|
---|
198 | STAMUNIT_ERRORS,
|
---|
199 | /** Number of occurences. */
|
---|
200 | STAMUNIT_OCCURENCES,
|
---|
201 | /** Ticks. */
|
---|
202 | STAMUNIT_TICKS,
|
---|
203 | /** Ticks per call. */
|
---|
204 | STAMUNIT_TICKS_PER_CALL,
|
---|
205 | /** Ticks per occurence. */
|
---|
206 | STAMUNIT_TICKS_PER_OCCURENCE,
|
---|
207 | /** Ratio of good vs. bad. */
|
---|
208 | STAMUNIT_GOOD_BAD,
|
---|
209 | /** Megabytes. */
|
---|
210 | STAMUNIT_MEGABYTES,
|
---|
211 | /** Kilobytes. */
|
---|
212 | STAMUNIT_KILOBYTES,
|
---|
213 | /** Nano seconds. */
|
---|
214 | STAMUNIT_NS,
|
---|
215 | /** Nanoseconds per call. */
|
---|
216 | STAMUNIT_NS_PER_CALL,
|
---|
217 | /** Nanoseconds per call. */
|
---|
218 | STAMUNIT_NS_PER_OCCURENCE,
|
---|
219 | /** Percentage. */
|
---|
220 | STAMUNIT_PCT,
|
---|
221 | /** Hertz. */
|
---|
222 | STAMUNIT_HZ,
|
---|
223 | /** The end (exclusive). */
|
---|
224 | STAMUNIT_END
|
---|
225 | } STAMUNIT;
|
---|
226 |
|
---|
227 |
|
---|
228 | /** @def STAM_REL_U8_INC
|
---|
229 | * Increments a uint8_t sample by one.
|
---|
230 | *
|
---|
231 | * @param pCounter Pointer to the uint8_t variable to operate on.
|
---|
232 | */
|
---|
233 | #ifndef VBOX_WITHOUT_RELEASE_STATISTICS
|
---|
234 | # define STAM_REL_U8_INC(pCounter) \
|
---|
235 | do { ++*(pCounter); } while (0)
|
---|
236 | #else
|
---|
237 | # define STAM_REL_U8_INC(pCounter) do { } while (0)
|
---|
238 | #endif
|
---|
239 | /** @def STAM_U8_INC
|
---|
240 | * Increments a uint8_t sample by one.
|
---|
241 | *
|
---|
242 | * @param pCounter Pointer to the uint8_t variable to operate on.
|
---|
243 | */
|
---|
244 | #ifdef VBOX_WITH_STATISTICS
|
---|
245 | # define STAM_U8_INC(pCounter) STAM_REL_U8_INC(pCounter)
|
---|
246 | #else
|
---|
247 | # define STAM_U8_INC(pCounter) do { } while (0)
|
---|
248 | #endif
|
---|
249 |
|
---|
250 |
|
---|
251 | /** @def STAM_REL_U8_DEC
|
---|
252 | * Decrements a uint8_t sample by one.
|
---|
253 | *
|
---|
254 | * @param pCounter Pointer to the uint8_t variable to operate on.
|
---|
255 | */
|
---|
256 | #ifndef VBOX_WITHOUT_RELEASE_STATISTICS
|
---|
257 | # define STAM_REL_U8_DEC(pCounter) \
|
---|
258 | do { --*(pCounter); } while (0)
|
---|
259 | #else
|
---|
260 | # define STAM_REL_U8_DEC(pCounter) do { } while (0)
|
---|
261 | #endif
|
---|
262 | /** @def STAM_U8_DEC
|
---|
263 | * Decrements a uint8_t sample by one.
|
---|
264 | *
|
---|
265 | * @param pCounter Pointer to the uint8_t variable to operate on.
|
---|
266 | */
|
---|
267 | #ifdef VBOX_WITH_STATISTICS
|
---|
268 | # define STAM_U8_DEC(pCounter) STAM_REL_U8_DEC(pCounter)
|
---|
269 | #else
|
---|
270 | # define STAM_U8_DEC(pCounter) do { } while (0)
|
---|
271 | #endif
|
---|
272 |
|
---|
273 |
|
---|
274 | /** @def STAM_REL_U8_ADD
|
---|
275 | * Increments a uint8_t sample by a value.
|
---|
276 | *
|
---|
277 | * @param pCounter Pointer to the uint8_t variable to operate on.
|
---|
278 | * @param Addend The value to add.
|
---|
279 | */
|
---|
280 | #ifndef VBOX_WITHOUT_RELEASE_STATISTICS
|
---|
281 | # define STAM_REL_U8_ADD(pCounter, Addend) \
|
---|
282 | do { *(pCounter) += (Addend); } while (0)
|
---|
283 | #else
|
---|
284 | # define STAM_REL_U8_ADD(pCounter, Addend) do { } while (0)
|
---|
285 | #endif
|
---|
286 | /** @def STAM_U8_ADD
|
---|
287 | * Increments a uint8_t sample by a value.
|
---|
288 | *
|
---|
289 | * @param pCounter Pointer to the uint8_t variable to operate on.
|
---|
290 | * @param Addend The value to add.
|
---|
291 | */
|
---|
292 | #ifdef VBOX_WITH_STATISTICS
|
---|
293 | # define STAM_U8_ADD(pCounter, Addend) STAM_REL_U8_ADD(pCounter, Addend
|
---|
294 | #else
|
---|
295 | # define STAM_U8_ADD(pCounter, Addend) do { } while (0)
|
---|
296 | #endif
|
---|
297 |
|
---|
298 |
|
---|
299 | /** @def STAM_REL_U16_INC
|
---|
300 | * Increments a uint16_t sample by one.
|
---|
301 | *
|
---|
302 | * @param pCounter Pointer to the uint16_t variable to operate on.
|
---|
303 | */
|
---|
304 | #ifndef VBOX_WITHOUT_RELEASE_STATISTICS
|
---|
305 | # define STAM_REL_U16_INC(pCounter) \
|
---|
306 | do { ++*(pCounter); } while (0)
|
---|
307 | #else
|
---|
308 | # define STAM_REL_U16_INC(pCounter) do { } while (0)
|
---|
309 | #endif
|
---|
310 | /** @def STAM_U16_INC
|
---|
311 | * Increments a uint16_t sample by one.
|
---|
312 | *
|
---|
313 | * @param pCounter Pointer to the uint16_t variable to operate on.
|
---|
314 | */
|
---|
315 | #ifdef VBOX_WITH_STATISTICS
|
---|
316 | # define STAM_U16_INC(pCounter) STAM_REL_U16_INC(pCounter)
|
---|
317 | #else
|
---|
318 | # define STAM_U16_INC(pCounter) do { } while (0)
|
---|
319 | #endif
|
---|
320 |
|
---|
321 |
|
---|
322 | /** @def STAM_REL_U16_DEC
|
---|
323 | * Decrements a uint16_t sample by one.
|
---|
324 | *
|
---|
325 | * @param pCounter Pointer to the uint16_t variable to operate on.
|
---|
326 | */
|
---|
327 | #ifndef VBOX_WITHOUT_RELEASE_STATISTICS
|
---|
328 | # define STAM_REL_U16_DEC(pCounter) \
|
---|
329 | do { --*(pCounter); } while (0)
|
---|
330 | #else
|
---|
331 | # define STAM_REL_U16_DEC(pCounter) do { } while (0)
|
---|
332 | #endif
|
---|
333 | /** @def STAM_U16_DEC
|
---|
334 | * Decrements a uint16_t sample by one.
|
---|
335 | *
|
---|
336 | * @param pCounter Pointer to the uint16_t variable to operate on.
|
---|
337 | */
|
---|
338 | #ifdef VBOX_WITH_STATISTICS
|
---|
339 | # define STAM_U16_DEC(pCounter) STAM_REL_U16_DEC(pCounter)
|
---|
340 | #else
|
---|
341 | # define STAM_U16_DEC(pCounter) do { } while (0)
|
---|
342 | #endif
|
---|
343 |
|
---|
344 |
|
---|
345 | /** @def STAM_REL_U16_INC
|
---|
346 | * Increments a uint16_t sample by a value.
|
---|
347 | *
|
---|
348 | * @param pCounter Pointer to the uint16_t variable to operate on.
|
---|
349 | * @param Addend The value to add.
|
---|
350 | */
|
---|
351 | #ifndef VBOX_WITHOUT_RELEASE_STATISTICS
|
---|
352 | # define STAM_REL_U16_ADD(pCounter, Addend) \
|
---|
353 | do { *(pCounter) += (Addend); } while (0)
|
---|
354 | #else
|
---|
355 | # define STAM_REL_U16_ADD(pCounter, Addend) do { } while (0)
|
---|
356 | #endif
|
---|
357 | /** @def STAM_U16_INC
|
---|
358 | * Increments a uint16_t sample by a value.
|
---|
359 | *
|
---|
360 | * @param pCounter Pointer to the uint16_t variable to operate on.
|
---|
361 | * @param Addend The value to add.
|
---|
362 | */
|
---|
363 | #ifdef VBOX_WITH_STATISTICS
|
---|
364 | # define STAM_U16_ADD(pCounter, Addend) STAM_REL_U16_ADD(pCounter, Addend)
|
---|
365 | #else
|
---|
366 | # define STAM_U16_ADD(pCounter, Addend) do { } while (0)
|
---|
367 | #endif
|
---|
368 |
|
---|
369 |
|
---|
370 | /** @def STAM_REL_U32_INC
|
---|
371 | * Increments a uint32_t sample by one.
|
---|
372 | *
|
---|
373 | * @param pCounter Pointer to the uint32_t variable to operate on.
|
---|
374 | */
|
---|
375 | #ifndef VBOX_WITHOUT_RELEASE_STATISTICS
|
---|
376 | # define STAM_REL_U32_INC(pCounter) \
|
---|
377 | do { ++*(pCounter); } while (0)
|
---|
378 | #else
|
---|
379 | # define STAM_REL_U32_INC(pCounter) do { } while (0)
|
---|
380 | #endif
|
---|
381 | /** @def STAM_U32_INC
|
---|
382 | * Increments a uint32_t sample by one.
|
---|
383 | *
|
---|
384 | * @param pCounter Pointer to the uint32_t variable to operate on.
|
---|
385 | */
|
---|
386 | #ifdef VBOX_WITH_STATISTICS
|
---|
387 | # define STAM_U32_INC(pCounter) STAM_REL_U32_INC(pCounter)
|
---|
388 | #else
|
---|
389 | # define STAM_U32_INC(pCounter) do { } while (0)
|
---|
390 | #endif
|
---|
391 |
|
---|
392 |
|
---|
393 | /** @def STAM_REL_U32_DEC
|
---|
394 | * Decrements a uint32_t sample by one.
|
---|
395 | *
|
---|
396 | * @param pCounter Pointer to the uint32_t variable to operate on.
|
---|
397 | */
|
---|
398 | #ifndef VBOX_WITHOUT_RELEASE_STATISTICS
|
---|
399 | # define STAM_REL_U32_DEC(pCounter) \
|
---|
400 | do { --*(pCounter); } while (0)
|
---|
401 | #else
|
---|
402 | # define STAM_REL_U32_DEC(pCounter) do { } while (0)
|
---|
403 | #endif
|
---|
404 | /** @def STAM_U32_DEC
|
---|
405 | * Decrements a uint32_t sample by one.
|
---|
406 | *
|
---|
407 | * @param pCounter Pointer to the uint32_t variable to operate on.
|
---|
408 | */
|
---|
409 | #ifdef VBOX_WITH_STATISTICS
|
---|
410 | # define STAM_U32_DEC(pCounter) STAM_REL_U32_DEC(pCounter)
|
---|
411 | #else
|
---|
412 | # define STAM_U32_DEC(pCounter) do { } while (0)
|
---|
413 | #endif
|
---|
414 |
|
---|
415 |
|
---|
416 | /** @def STAM_REL_U32_ADD
|
---|
417 | * Increments a uint32_t sample by value.
|
---|
418 | *
|
---|
419 | * @param pCounter Pointer to the uint32_t variable to operate on.
|
---|
420 | * @param Addend The value to add.
|
---|
421 | */
|
---|
422 | #ifndef VBOX_WITHOUT_RELEASE_STATISTICS
|
---|
423 | # define STAM_REL_U32_ADD(pCounter, Addend) \
|
---|
424 | do { *(pCounter) += (Addend); } while (0)
|
---|
425 | #else
|
---|
426 | # define STAM_REL_U32_ADD(pCounter, Addend) do { } while (0)
|
---|
427 | #endif
|
---|
428 | /** @def STAM_U32_ADD
|
---|
429 | * Increments a uint32_t sample by value.
|
---|
430 | *
|
---|
431 | * @param pCounter Pointer to the uint32_t variable to operate on.
|
---|
432 | * @param Addend The value to add.
|
---|
433 | */
|
---|
434 | #ifdef VBOX_WITH_STATISTICS
|
---|
435 | # define STAM_U32_ADD(pCounter, Addend) STAM_REL_U32_ADD(pCounter, Addend)
|
---|
436 | #else
|
---|
437 | # define STAM_U32_ADD(pCounter, Addend) do { } while (0)
|
---|
438 | #endif
|
---|
439 |
|
---|
440 |
|
---|
441 | /** @def STAM_REL_U64_INC
|
---|
442 | * Increments a uint64_t sample by one.
|
---|
443 | *
|
---|
444 | * @param pCounter Pointer to the uint64_t variable to operate on.
|
---|
445 | */
|
---|
446 | #ifndef VBOX_WITHOUT_RELEASE_STATISTICS
|
---|
447 | # define STAM_REL_U64_INC(pCounter) \
|
---|
448 | do { ++*(pCounter); } while (0)
|
---|
449 | #else
|
---|
450 | # define STAM_REL_U64_INC(pCounter) do { } while (0)
|
---|
451 | #endif
|
---|
452 | /** @def STAM_U64_INC
|
---|
453 | * Increments a uint64_t sample by one.
|
---|
454 | *
|
---|
455 | * @param pCounter Pointer to the uint64_t variable to operate on.
|
---|
456 | */
|
---|
457 | #ifdef VBOX_WITH_STATISTICS
|
---|
458 | # define STAM_U64_INC(pCounter) STAM_REL_U64_INC(pCounter)
|
---|
459 | #else
|
---|
460 | # define STAM_U64_INC(pCounter) do { } while (0)
|
---|
461 | #endif
|
---|
462 |
|
---|
463 |
|
---|
464 | /** @def STAM_REL_U64_DEC
|
---|
465 | * Decrements a uint64_t sample by one.
|
---|
466 | *
|
---|
467 | * @param pCounter Pointer to the uint64_t variable to operate on.
|
---|
468 | */
|
---|
469 | #ifndef VBOX_WITHOUT_RELEASE_STATISTICS
|
---|
470 | # define STAM_REL_U64_DEC(pCounter) \
|
---|
471 | do { --*(pCounter); } while (0)
|
---|
472 | #else
|
---|
473 | # define STAM_REL_U64_DEC(pCounter) do { } while (0)
|
---|
474 | #endif
|
---|
475 | /** @def STAM_U64_DEC
|
---|
476 | * Decrements a uint64_t sample by one.
|
---|
477 | *
|
---|
478 | * @param pCounter Pointer to the uint64_t variable to operate on.
|
---|
479 | */
|
---|
480 | #ifdef VBOX_WITH_STATISTICS
|
---|
481 | # define STAM_U64_DEC(pCounter) STAM_REL_U64_DEC(pCounter)
|
---|
482 | #else
|
---|
483 | # define STAM_U64_DEC(pCounter) do { } while (0)
|
---|
484 | #endif
|
---|
485 |
|
---|
486 |
|
---|
487 | /** @def STAM_REL_U64_ADD
|
---|
488 | * Increments a uint64_t sample by a value.
|
---|
489 | *
|
---|
490 | * @param pCounter Pointer to the uint64_t variable to operate on.
|
---|
491 | * @param Addend The value to add.
|
---|
492 | */
|
---|
493 | #ifndef VBOX_WITHOUT_RELEASE_STATISTICS
|
---|
494 | # define STAM_REL_U64_ADD(pCounter, Addend) \
|
---|
495 | do { *(pCounter) += (Addend); } while (0)
|
---|
496 | #else
|
---|
497 | # define STAM_REL_U64_ADD(pCounter, Addend) do { } while (0)
|
---|
498 | #endif
|
---|
499 | /** @def STAM_U64_ADD
|
---|
500 | * Increments a uint64_t sample by a value.
|
---|
501 | *
|
---|
502 | * @param pCounter Pointer to the uint64_t variable to operate on.
|
---|
503 | * @param Addend The value to add.
|
---|
504 | */
|
---|
505 | #ifdef VBOX_WITH_STATISTICS
|
---|
506 | # define STAM_U64_ADD(pCounter, Addend) STAM_REL_U64_ADD(pCounter, Addend)
|
---|
507 | #else
|
---|
508 | # define STAM_U64_ADD(pCounter, Addend) do { } while (0)
|
---|
509 | #endif
|
---|
510 |
|
---|
511 |
|
---|
512 | /**
|
---|
513 | * Counter sample - STAMTYPE_COUNTER.
|
---|
514 | */
|
---|
515 | typedef struct STAMCOUNTER
|
---|
516 | {
|
---|
517 | /** The current count. */
|
---|
518 | volatile uint64_t c;
|
---|
519 | } STAMCOUNTER;
|
---|
520 | /** Pointer to a counter. */
|
---|
521 | typedef STAMCOUNTER *PSTAMCOUNTER;
|
---|
522 | /** Pointer to a const counter. */
|
---|
523 | typedef const STAMCOUNTER *PCSTAMCOUNTER;
|
---|
524 |
|
---|
525 |
|
---|
526 | /** @def STAM_REL_COUNTER_INC
|
---|
527 | * Increments a counter sample by one.
|
---|
528 | *
|
---|
529 | * @param pCounter Pointer to the STAMCOUNTER structure to operate on.
|
---|
530 | */
|
---|
531 | #ifndef VBOX_WITHOUT_RELEASE_STATISTICS
|
---|
532 | # define STAM_REL_COUNTER_INC(pCounter) \
|
---|
533 | do { (pCounter)->c++; } while (0)
|
---|
534 | #else
|
---|
535 | # define STAM_REL_COUNTER_INC(pCounter) do { } while (0)
|
---|
536 | #endif
|
---|
537 | /** @def STAM_COUNTER_INC
|
---|
538 | * Increments a counter sample by one.
|
---|
539 | *
|
---|
540 | * @param pCounter Pointer to the STAMCOUNTER structure to operate on.
|
---|
541 | */
|
---|
542 | #ifdef VBOX_WITH_STATISTICS
|
---|
543 | # define STAM_COUNTER_INC(pCounter) STAM_REL_COUNTER_INC(pCounter)
|
---|
544 | #else
|
---|
545 | # define STAM_COUNTER_INC(pCounter) do { } while (0)
|
---|
546 | #endif
|
---|
547 |
|
---|
548 |
|
---|
549 | /** @def STAM_REL_COUNTER_DEC
|
---|
550 | * Decrements a counter sample by one.
|
---|
551 | *
|
---|
552 | * @param pCounter Pointer to the STAMCOUNTER structure to operate on.
|
---|
553 | */
|
---|
554 | #ifndef VBOX_WITHOUT_RELEASE_STATISTICS
|
---|
555 | # define STAM_REL_COUNTER_DEC(pCounter) \
|
---|
556 | do { (pCounter)->c--; } while (0)
|
---|
557 | #else
|
---|
558 | # define STAM_REL_COUNTER_DEC(pCounter) do { } while (0)
|
---|
559 | #endif
|
---|
560 | /** @def STAM_COUNTER_DEC
|
---|
561 | * Decrements a counter sample by one.
|
---|
562 | *
|
---|
563 | * @param pCounter Pointer to the STAMCOUNTER structure to operate on.
|
---|
564 | */
|
---|
565 | #ifdef VBOX_WITH_STATISTICS
|
---|
566 | # define STAM_COUNTER_DEC(pCounter) STAM_REL_COUNTER_DEC(pCounter)
|
---|
567 | #else
|
---|
568 | # define STAM_COUNTER_DEC(pCounter) do { } while (0)
|
---|
569 | #endif
|
---|
570 |
|
---|
571 |
|
---|
572 | /** @def STAM_REL_COUNTER_ADD
|
---|
573 | * Increments a counter sample by a value.
|
---|
574 | *
|
---|
575 | * @param pCounter Pointer to the STAMCOUNTER structure to operate on.
|
---|
576 | * @param Addend The value to add to the counter.
|
---|
577 | */
|
---|
578 | #ifndef VBOX_WITHOUT_RELEASE_STATISTICS
|
---|
579 | # define STAM_REL_COUNTER_ADD(pCounter, Addend) \
|
---|
580 | do { (pCounter)->c += (Addend); } while (0)
|
---|
581 | #else
|
---|
582 | # define STAM_REL_COUNTER_ADD(pCounter, Addend) do { } while (0)
|
---|
583 | #endif
|
---|
584 | /** @def STAM_COUNTER_ADD
|
---|
585 | * Increments a counter sample by a value.
|
---|
586 | *
|
---|
587 | * @param pCounter Pointer to the STAMCOUNTER structure to operate on.
|
---|
588 | * @param Addend The value to add to the counter.
|
---|
589 | */
|
---|
590 | #ifdef VBOX_WITH_STATISTICS
|
---|
591 | # define STAM_COUNTER_ADD(pCounter, Addend) STAM_REL_COUNTER_ADD(pCounter, Addend)
|
---|
592 | #else
|
---|
593 | # define STAM_COUNTER_ADD(pCounter, Addend) do { } while (0)
|
---|
594 | #endif
|
---|
595 |
|
---|
596 |
|
---|
597 | /** @def STAM_REL_COUNTER_RESET
|
---|
598 | * Resets the statistics sample.
|
---|
599 | */
|
---|
600 | #ifndef VBOX_WITHOUT_RELEASE_STATISTICS
|
---|
601 | # define STAM_REL_COUNTER_RESET(pCounter) do { (pCounter)->c = 0; } while (0)
|
---|
602 | #else
|
---|
603 | # define STAM_REL_COUNTER_RESET(pCounter) do { } while (0)
|
---|
604 | #endif
|
---|
605 | /** @def STAM_COUNTER_RESET
|
---|
606 | * Resets the statistics sample.
|
---|
607 | */
|
---|
608 | #ifdef VBOX_WITH_STATISTICS
|
---|
609 | # define STAM_COUNTER_RESET(pCounter) STAM_REL_COUNTER_RESET(pCounter)
|
---|
610 | #else
|
---|
611 | # define STAM_COUNTER_RESET(pCounter) do { } while (0)
|
---|
612 | #endif
|
---|
613 |
|
---|
614 |
|
---|
615 |
|
---|
616 | /**
|
---|
617 | * Profiling sample - STAMTYPE_PROFILE.
|
---|
618 | */
|
---|
619 | typedef struct STAMPROFILE
|
---|
620 | {
|
---|
621 | /** Number of periods. */
|
---|
622 | volatile uint64_t cPeriods;
|
---|
623 | /** Total count of ticks. */
|
---|
624 | volatile uint64_t cTicks;
|
---|
625 | /** Maximum tick count during a sampling. */
|
---|
626 | volatile uint64_t cTicksMax;
|
---|
627 | /** Minimum tick count during a sampling. */
|
---|
628 | volatile uint64_t cTicksMin;
|
---|
629 | } STAMPROFILE;
|
---|
630 | /** Pointer to a profile sample. */
|
---|
631 | typedef STAMPROFILE *PSTAMPROFILE;
|
---|
632 | /** Pointer to a const profile sample. */
|
---|
633 | typedef const STAMPROFILE *PCSTAMPROFILE;
|
---|
634 |
|
---|
635 |
|
---|
636 | /** @def STAM_REL_PROFILE_ADD_PERIOD
|
---|
637 | * Adds a period.
|
---|
638 | *
|
---|
639 | * @param pProfileAdv Pointer to the STAMPROFILEADV structure to operate on.
|
---|
640 | * @param cTicksInPeriod The number of tick (or whatever) of the preiod
|
---|
641 | * being added. This is only referenced once.
|
---|
642 | */
|
---|
643 | #ifndef VBOX_WITHOUT_RELEASE_STATISTICS
|
---|
644 | # define STAM_REL_PROFILE_ADD_PERIOD(pProfile, cTicksInPeriod) \
|
---|
645 | do { \
|
---|
646 | uint64_t const StamPrefix_cTicks = (cTicksInPeriod); \
|
---|
647 | (pProfile)->cTicks += StamPrefix_cTicks; \
|
---|
648 | (pProfile)->cPeriods++; \
|
---|
649 | if ((pProfile)->cTicksMax < StamPrefix_cTicks) \
|
---|
650 | (pProfile)->cTicksMax = StamPrefix_cTicks; \
|
---|
651 | if ((pProfile)->cTicksMin > StamPrefix_cTicks) \
|
---|
652 | (pProfile)->cTicksMin = StamPrefix_cTicks; \
|
---|
653 | } while (0)
|
---|
654 | #else
|
---|
655 | # define STAM_REL_PROFILE_ADD_PERIOD(pProfile, cTicksInPeriod) do { } while (0)
|
---|
656 | #endif
|
---|
657 | /** @def STAM_PROFILE_ADD_PERIOD
|
---|
658 | * Adds a period.
|
---|
659 | *
|
---|
660 | * @param pProfileAdv Pointer to the STAMPROFILEADV structure to operate on.
|
---|
661 | * @param cTicksInPeriod The number of tick (or whatever) of the preiod
|
---|
662 | * being added. This is only referenced once.
|
---|
663 | */
|
---|
664 | #ifdef VBOX_WITH_STATISTICS
|
---|
665 | # define STAM_PROFILE_ADD_PERIOD(pProfile, cTicksInPeriod) STAM_REL_PROFILE_ADD_PERIOD(pProfile, cTicksInPeriod)
|
---|
666 | #else
|
---|
667 | # define STAM_PROFILE_ADD_PERIOD(pProfile, cTicksInPeriod) do { } while (0)
|
---|
668 | #endif
|
---|
669 |
|
---|
670 |
|
---|
671 | /** @def STAM_REL_PROFILE_START
|
---|
672 | * Samples the start time of a profiling period.
|
---|
673 | *
|
---|
674 | * @param pProfile Pointer to the STAMPROFILE structure to operate on.
|
---|
675 | * @param Prefix Identifier prefix used to internal variables.
|
---|
676 | *
|
---|
677 | * @remarks Declears a stack variable that will be used by related macros.
|
---|
678 | */
|
---|
679 | #ifndef VBOX_WITHOUT_RELEASE_STATISTICS
|
---|
680 | # define STAM_REL_PROFILE_START(pProfile, Prefix) \
|
---|
681 | uint64_t Prefix##_tsStart; \
|
---|
682 | STAM_GET_TS(Prefix##_tsStart); \
|
---|
683 | NOREF(Prefix##_tsStart)
|
---|
684 | #else
|
---|
685 | # define STAM_REL_PROFILE_START(pProfile, Prefix) do { } while (0)
|
---|
686 | #endif
|
---|
687 | /** @def STAM_PROFILE_START
|
---|
688 | * Samples the start time of a profiling period.
|
---|
689 | *
|
---|
690 | * @param pProfile Pointer to the STAMPROFILE structure to operate on.
|
---|
691 | * @param Prefix Identifier prefix used to internal variables.
|
---|
692 | *
|
---|
693 | * @remarks Declears a stack variable that will be used by related macros.
|
---|
694 | */
|
---|
695 | #ifdef VBOX_WITH_STATISTICS
|
---|
696 | # define STAM_PROFILE_START(pProfile, Prefix) STAM_REL_PROFILE_START(pProfile, Prefix)
|
---|
697 | #else
|
---|
698 | # define STAM_PROFILE_START(pProfile, Prefix) do { } while (0)
|
---|
699 | #endif
|
---|
700 |
|
---|
701 | /** @def STAM_REL_PROFILE_STOP
|
---|
702 | * Samples the stop time of a profiling period and updates the sample.
|
---|
703 | *
|
---|
704 | * @param pProfile Pointer to the STAMPROFILE structure to operate on.
|
---|
705 | * @param Prefix Identifier prefix used to internal variables.
|
---|
706 | */
|
---|
707 | #ifndef VBOX_WITHOUT_RELEASE_STATISTICS
|
---|
708 | # define STAM_REL_PROFILE_STOP(pProfile, Prefix) \
|
---|
709 | do { \
|
---|
710 | uint64_t Prefix##_cTicks; \
|
---|
711 | STAM_GET_TS(Prefix##_cTicks); \
|
---|
712 | Prefix##_cTicks -= Prefix##_tsStart; \
|
---|
713 | (pProfile)->cTicks += Prefix##_cTicks; \
|
---|
714 | (pProfile)->cPeriods++; \
|
---|
715 | if ((pProfile)->cTicksMax < Prefix##_cTicks) \
|
---|
716 | (pProfile)->cTicksMax = Prefix##_cTicks; \
|
---|
717 | if ((pProfile)->cTicksMin > Prefix##_cTicks) \
|
---|
718 | (pProfile)->cTicksMin = Prefix##_cTicks; \
|
---|
719 | } while (0)
|
---|
720 | #else
|
---|
721 | # define STAM_REL_PROFILE_STOP(pProfile, Prefix) do { } while (0)
|
---|
722 | #endif
|
---|
723 | /** @def STAM_PROFILE_STOP
|
---|
724 | * Samples the stop time of a profiling period and updates the sample.
|
---|
725 | *
|
---|
726 | * @param pProfile Pointer to the STAMPROFILE structure to operate on.
|
---|
727 | * @param Prefix Identifier prefix used to internal variables.
|
---|
728 | */
|
---|
729 | #ifdef VBOX_WITH_STATISTICS
|
---|
730 | # define STAM_PROFILE_STOP(pProfile, Prefix) STAM_REL_PROFILE_STOP(pProfile, Prefix)
|
---|
731 | #else
|
---|
732 | # define STAM_PROFILE_STOP(pProfile, Prefix) do { } while (0)
|
---|
733 | #endif
|
---|
734 |
|
---|
735 |
|
---|
736 | /** @def STAM_REL_PROFILE_STOP_EX
|
---|
737 | * Samples the stop time of a profiling period and updates both the sample
|
---|
738 | * and an attribution sample.
|
---|
739 | *
|
---|
740 | * @param pProfile Pointer to the STAMPROFILE structure to operate on.
|
---|
741 | * @param pProfile2 Pointer to the STAMPROFILE structure which this
|
---|
742 | * interval should be attributed to as well. This may be NULL.
|
---|
743 | * @param Prefix Identifier prefix used to internal variables.
|
---|
744 | */
|
---|
745 | #ifndef VBOX_WITHOUT_RELEASE_STATISTICS
|
---|
746 | # define STAM_REL_PROFILE_STOP_EX(pProfile, pProfile2, Prefix) \
|
---|
747 | do { \
|
---|
748 | uint64_t Prefix##_cTicks; \
|
---|
749 | STAM_GET_TS(Prefix##_cTicks); \
|
---|
750 | Prefix##_cTicks -= Prefix##_tsStart; \
|
---|
751 | (pProfile)->cTicks += Prefix##_cTicks; \
|
---|
752 | (pProfile)->cPeriods++; \
|
---|
753 | if ((pProfile)->cTicksMax < Prefix##_cTicks) \
|
---|
754 | (pProfile)->cTicksMax = Prefix##_cTicks; \
|
---|
755 | if ((pProfile)->cTicksMin > Prefix##_cTicks) \
|
---|
756 | (pProfile)->cTicksMin = Prefix##_cTicks; \
|
---|
757 | \
|
---|
758 | if ((pProfile2)) \
|
---|
759 | { \
|
---|
760 | (pProfile2)->cTicks += Prefix##_cTicks; \
|
---|
761 | (pProfile2)->cPeriods++; \
|
---|
762 | if ((pProfile2)->cTicksMax < Prefix##_cTicks) \
|
---|
763 | (pProfile2)->cTicksMax = Prefix##_cTicks; \
|
---|
764 | if ((pProfile2)->cTicksMin > Prefix##_cTicks) \
|
---|
765 | (pProfile2)->cTicksMin = Prefix##_cTicks; \
|
---|
766 | } \
|
---|
767 | } while (0)
|
---|
768 | #else
|
---|
769 | # define STAM_REL_PROFILE_STOP_EX(pProfile, pProfile2, Prefix) do { } while (0)
|
---|
770 | #endif
|
---|
771 | /** @def STAM_PROFILE_STOP_EX
|
---|
772 | * Samples the stop time of a profiling period and updates both the sample
|
---|
773 | * and an attribution sample.
|
---|
774 | *
|
---|
775 | * @param pProfile Pointer to the STAMPROFILE structure to operate on.
|
---|
776 | * @param pProfile2 Pointer to the STAMPROFILE structure which this
|
---|
777 | * interval should be attributed to as well. This may be NULL.
|
---|
778 | * @param Prefix Identifier prefix used to internal variables.
|
---|
779 | */
|
---|
780 | #ifdef VBOX_WITH_STATISTICS
|
---|
781 | # define STAM_PROFILE_STOP_EX(pProfile, pProfile2, Prefix) STAM_REL_PROFILE_STOP_EX(pProfile, pProfile2, Prefix)
|
---|
782 | #else
|
---|
783 | # define STAM_PROFILE_STOP_EX(pProfile, pProfile2, Prefix) do { } while (0)
|
---|
784 | #endif
|
---|
785 |
|
---|
786 |
|
---|
787 | /**
|
---|
788 | * Advanced profiling sample - STAMTYPE_PROFILE_ADV.
|
---|
789 | *
|
---|
790 | * Identical to a STAMPROFILE sample, but the start timestamp
|
---|
791 | * is stored after the STAMPROFILE structure so the sampling
|
---|
792 | * can start and stop in different functions.
|
---|
793 | */
|
---|
794 | typedef struct STAMPROFILEADV
|
---|
795 | {
|
---|
796 | /** The STAMPROFILE core. */
|
---|
797 | STAMPROFILE Core;
|
---|
798 | /** The start timestamp. */
|
---|
799 | volatile uint64_t tsStart;
|
---|
800 | } STAMPROFILEADV;
|
---|
801 | /** Pointer to a advanced profile sample. */
|
---|
802 | typedef STAMPROFILEADV *PSTAMPROFILEADV;
|
---|
803 | /** Pointer to a const advanced profile sample. */
|
---|
804 | typedef const STAMPROFILEADV *PCSTAMPROFILEADV;
|
---|
805 |
|
---|
806 |
|
---|
807 | /** @def STAM_REL_PROFILE_ADV_START
|
---|
808 | * Samples the start time of a profiling period.
|
---|
809 | *
|
---|
810 | * @param pProfileAdv Pointer to the STAMPROFILEADV structure to operate on.
|
---|
811 | * @param Prefix Identifier prefix used to internal variables.
|
---|
812 | */
|
---|
813 | #ifndef VBOX_WITHOUT_RELEASE_STATISTICS
|
---|
814 | # define STAM_REL_PROFILE_ADV_START(pProfileAdv, Prefix) \
|
---|
815 | STAM_GET_TS((pProfileAdv)->tsStart)
|
---|
816 | #else
|
---|
817 | # define STAM_REL_PROFILE_ADV_START(pProfileAdv, Prefix) do { } while (0)
|
---|
818 | #endif
|
---|
819 | /** @def STAM_PROFILE_ADV_START
|
---|
820 | * Samples the start time of a profiling period.
|
---|
821 | *
|
---|
822 | * @param pProfileAdv Pointer to the STAMPROFILEADV structure to operate on.
|
---|
823 | * @param Prefix Identifier prefix used to internal variables.
|
---|
824 | */
|
---|
825 | #ifdef VBOX_WITH_STATISTICS
|
---|
826 | # define STAM_PROFILE_ADV_START(pProfileAdv, Prefix) STAM_REL_PROFILE_ADV_START(pProfileAdv, Prefix)
|
---|
827 | #else
|
---|
828 | # define STAM_PROFILE_ADV_START(pProfileAdv, Prefix) do { } while (0)
|
---|
829 | #endif
|
---|
830 |
|
---|
831 |
|
---|
832 | /** @def STAM_REL_PROFILE_ADV_STOP
|
---|
833 | * Samples the stop time of a profiling period (if running) and updates the
|
---|
834 | * sample.
|
---|
835 | *
|
---|
836 | * @param pProfileAdv Pointer to the STAMPROFILEADV structure to operate on.
|
---|
837 | * @param Prefix Identifier prefix used to internal variables.
|
---|
838 | */
|
---|
839 | #ifndef VBOX_WITHOUT_RELEASE_STATISTICS
|
---|
840 | # define STAM_REL_PROFILE_ADV_STOP(pProfileAdv, Prefix) \
|
---|
841 | do { \
|
---|
842 | if ((pProfileAdv)->tsStart) \
|
---|
843 | { \
|
---|
844 | uint64_t Prefix##_cTicks; \
|
---|
845 | STAM_GET_TS(Prefix##_cTicks); \
|
---|
846 | Prefix##_cTicks -= (pProfileAdv)->tsStart; \
|
---|
847 | (pProfileAdv)->tsStart = 0; \
|
---|
848 | (pProfileAdv)->Core.cTicks += Prefix##_cTicks; \
|
---|
849 | (pProfileAdv)->Core.cPeriods++; \
|
---|
850 | if ((pProfileAdv)->Core.cTicksMax < Prefix##_cTicks) \
|
---|
851 | (pProfileAdv)->Core.cTicksMax = Prefix##_cTicks; \
|
---|
852 | if ((pProfileAdv)->Core.cTicksMin > Prefix##_cTicks) \
|
---|
853 | (pProfileAdv)->Core.cTicksMin = Prefix##_cTicks; \
|
---|
854 | } \
|
---|
855 | } while (0)
|
---|
856 | #else
|
---|
857 | # define STAM_REL_PROFILE_ADV_STOP(pProfileAdv, Prefix) do { } while (0)
|
---|
858 | #endif
|
---|
859 | /** @def STAM_PROFILE_ADV_STOP
|
---|
860 | * Samples the stop time of a profiling period (if running) and updates the
|
---|
861 | * sample.
|
---|
862 | *
|
---|
863 | * @param pProfileAdv Pointer to the STAMPROFILEADV structure to operate on.
|
---|
864 | * @param Prefix Identifier prefix used to internal variables.
|
---|
865 | */
|
---|
866 | #ifdef VBOX_WITH_STATISTICS
|
---|
867 | # define STAM_PROFILE_ADV_STOP(pProfileAdv, Prefix) STAM_REL_PROFILE_ADV_STOP(pProfileAdv, Prefix)
|
---|
868 | #else
|
---|
869 | # define STAM_PROFILE_ADV_STOP(pProfileAdv, Prefix) do { } while (0)
|
---|
870 | #endif
|
---|
871 |
|
---|
872 |
|
---|
873 | /** @def STAM_REL_PROFILE_ADV_STOP_START
|
---|
874 | * Stops one profile counter (if running) and starts another one.
|
---|
875 | *
|
---|
876 | * @param pProfileAdv1 Pointer to the STAMPROFILEADV structure to stop.
|
---|
877 | * @param pProfileAdv2 Pointer to the STAMPROFILEADV structure to start.
|
---|
878 | * @param Prefix Identifier prefix used to internal variables.
|
---|
879 | */
|
---|
880 | #ifndef VBOX_WITHOUT_RELEASE_STATISTICS
|
---|
881 | # define STAM_REL_PROFILE_ADV_STOP_START(pProfileAdv1, pProfileAdv2, Prefix) \
|
---|
882 | do { \
|
---|
883 | uint64_t Prefix##_cTicks; \
|
---|
884 | STAM_GET_TS(Prefix##_cTicks); \
|
---|
885 | (pProfileAdv2)->tsStart = Prefix##_cTicks; \
|
---|
886 | if ((pProfileAdv1)->tsStart) \
|
---|
887 | { \
|
---|
888 | Prefix##_cTicks -= (pProfileAdv1)->tsStart; \
|
---|
889 | (pProfileAdv1)->tsStart = 0; \
|
---|
890 | (pProfileAdv1)->Core.cTicks += Prefix##_cTicks; \
|
---|
891 | (pProfileAdv1)->Core.cPeriods++; \
|
---|
892 | if ((pProfileAdv1)->Core.cTicksMax < Prefix##_cTicks) \
|
---|
893 | (pProfileAdv1)->Core.cTicksMax = Prefix##_cTicks; \
|
---|
894 | if ((pProfileAdv1)->Core.cTicksMin > Prefix##_cTicks) \
|
---|
895 | (pProfileAdv1)->Core.cTicksMin = Prefix##_cTicks; \
|
---|
896 | } \
|
---|
897 | } while (0)
|
---|
898 | #else
|
---|
899 | # define STAM_REL_PROFILE_ADV_STOP_START(pProfileAdv1, pProfileAdv2, Prefix) \
|
---|
900 | do { } while (0)
|
---|
901 | #endif
|
---|
902 | /** @def STAM_PROFILE_ADV_STOP_START
|
---|
903 | * Samples the stop time of a profiling period (if running) and updates the
|
---|
904 | * sample.
|
---|
905 | *
|
---|
906 | * @param pProfileAdv Pointer to the STAMPROFILEADV structure to operate on.
|
---|
907 | * @param Prefix Identifier prefix used to internal variables.
|
---|
908 | */
|
---|
909 | #ifdef VBOX_WITH_STATISTICS
|
---|
910 | # define STAM_PROFILE_ADV_STOP_START(pProfileAdv1, pProfileAdv2, Prefix) \
|
---|
911 | STAM_REL_PROFILE_ADV_STOP_START(pProfileAdv1, pProfileAdv2, Prefix)
|
---|
912 | #else
|
---|
913 | # define STAM_PROFILE_ADV_STOP_START(pProfileAdv1, pProfileAdv2, Prefix) \
|
---|
914 | do { } while (0)
|
---|
915 | #endif
|
---|
916 |
|
---|
917 |
|
---|
918 | /** @def STAM_REL_PROFILE_ADV_SUSPEND
|
---|
919 | * Suspends the sampling for a while. This can be useful to exclude parts
|
---|
920 | * covered by other samples without screwing up the count, and average+min times.
|
---|
921 | *
|
---|
922 | * @param pProfileAdv Pointer to the STAMPROFILEADV structure to operate on.
|
---|
923 | * @param Prefix Identifier prefix used to internal variables. The prefix
|
---|
924 | * must match that of the resume one since it stores the
|
---|
925 | * suspend time in a stack variable.
|
---|
926 | */
|
---|
927 | #ifndef VBOX_WITHOUT_RELEASE_STATISTICS
|
---|
928 | # define STAM_REL_PROFILE_ADV_SUSPEND(pProfileAdv, Prefix) \
|
---|
929 | uint64_t Prefix##_tsSuspend; \
|
---|
930 | STAM_GET_TS(Prefix##_tsSuspend)
|
---|
931 | #else
|
---|
932 | # define STAM_REL_PROFILE_ADV_SUSPEND(pProfileAdv, Prefix) do { } while (0)
|
---|
933 | #endif
|
---|
934 | /** @def STAM_PROFILE_ADV_SUSPEND
|
---|
935 | * Suspends the sampling for a while. This can be useful to exclude parts
|
---|
936 | * covered by other samples without screwing up the count, and average+min times.
|
---|
937 | *
|
---|
938 | * @param pProfileAdv Pointer to the STAMPROFILEADV structure to operate on.
|
---|
939 | * @param Prefix Identifier prefix used to internal variables. The prefix
|
---|
940 | * must match that of the resume one since it stores the
|
---|
941 | * suspend time in a stack variable.
|
---|
942 | */
|
---|
943 | #ifdef VBOX_WITH_STATISTICS
|
---|
944 | # define STAM_PROFILE_ADV_SUSPEND(pProfileAdv, Prefix) STAM_REL_PROFILE_ADV_SUSPEND(pProfileAdv, Prefix)
|
---|
945 | #else
|
---|
946 | # define STAM_PROFILE_ADV_SUSPEND(pProfileAdv, Prefix) do { } while (0)
|
---|
947 | #endif
|
---|
948 |
|
---|
949 |
|
---|
950 | /** @def STAM_REL_PROFILE_ADV_RESUME
|
---|
951 | * Counter to STAM_REL_PROFILE_ADV_SUSPEND.
|
---|
952 | *
|
---|
953 | * @param pProfileAdv Pointer to the STAMPROFILEADV structure to operate on.
|
---|
954 | * @param Prefix Identifier prefix used to internal variables. This must
|
---|
955 | * match the one used with the SUSPEND!
|
---|
956 | */
|
---|
957 | #ifndef VBOX_WITHOUT_RELEASE_STATISTICS
|
---|
958 | # define STAM_REL_PROFILE_ADV_RESUME(pProfileAdv, Prefix) \
|
---|
959 | do { \
|
---|
960 | uint64_t Prefix##_tsNow; \
|
---|
961 | STAM_GET_TS(Prefix##_tsNow); \
|
---|
962 | (pProfileAdv)->tsStart += Prefix##_tsNow - Prefix##_tsSuspend; \
|
---|
963 | } while (0)
|
---|
964 | #else
|
---|
965 | # define STAM_REL_PROFILE_ADV_RESUME(pProfileAdv, Prefix) do { } while (0)
|
---|
966 | #endif
|
---|
967 | /** @def STAM_PROFILE_ADV_RESUME
|
---|
968 | * Counter to STAM_PROFILE_ADV_SUSPEND.
|
---|
969 | *
|
---|
970 | * @param pProfileAdv Pointer to the STAMPROFILEADV structure to operate on.
|
---|
971 | * @param Prefix Identifier prefix used to internal variables. This must
|
---|
972 | * match the one used with the SUSPEND!
|
---|
973 | */
|
---|
974 | #ifdef VBOX_WITH_STATISTICS
|
---|
975 | # define STAM_PROFILE_ADV_RESUME(pProfileAdv, Prefix) STAM_REL_PROFILE_ADV_RESUME(pProfileAdv, Prefix)
|
---|
976 | #else
|
---|
977 | # define STAM_PROFILE_ADV_RESUME(pProfileAdv, Prefix) do { } while (0)
|
---|
978 | #endif
|
---|
979 |
|
---|
980 |
|
---|
981 | /** @def STAM_REL_PROFILE_ADV_STOP_EX
|
---|
982 | * Samples the stop time of a profiling period (if running) and updates both
|
---|
983 | * the sample and an attribution sample.
|
---|
984 | *
|
---|
985 | * @param pProfileAdv Pointer to the STAMPROFILEADV structure to operate on.
|
---|
986 | * @param pProfile2 Pointer to the STAMPROFILE structure which this
|
---|
987 | * interval should be attributed to as well. This may be NULL.
|
---|
988 | * @param Prefix Identifier prefix used to internal variables.
|
---|
989 | */
|
---|
990 | #ifndef VBOX_WITHOUT_RELEASE_STATISTICS
|
---|
991 | # define STAM_REL_PROFILE_ADV_STOP_EX(pProfileAdv, pProfile2, Prefix) \
|
---|
992 | do { \
|
---|
993 | if ((pProfileAdv)->tsStart) \
|
---|
994 | { \
|
---|
995 | uint64_t Prefix##_cTicks; \
|
---|
996 | STAM_GET_TS(Prefix##_cTicks); \
|
---|
997 | Prefix##_cTicks -= (pProfileAdv)->tsStart; \
|
---|
998 | (pProfileAdv)->tsStart = 0; \
|
---|
999 | (pProfileAdv)->Core.cTicks += Prefix##_cTicks; \
|
---|
1000 | (pProfileAdv)->Core.cPeriods++; \
|
---|
1001 | if ((pProfileAdv)->Core.cTicksMax < Prefix##_cTicks) \
|
---|
1002 | (pProfileAdv)->Core.cTicksMax = Prefix##_cTicks; \
|
---|
1003 | if ((pProfileAdv)->Core.cTicksMin > Prefix##_cTicks) \
|
---|
1004 | (pProfileAdv)->Core.cTicksMin = Prefix##_cTicks; \
|
---|
1005 | if ((pProfile2)) \
|
---|
1006 | { \
|
---|
1007 | (pProfile2)->cTicks += Prefix##_cTicks; \
|
---|
1008 | (pProfile2)->cPeriods++; \
|
---|
1009 | if ((pProfile2)->cTicksMax < Prefix##_cTicks) \
|
---|
1010 | (pProfile2)->cTicksMax = Prefix##_cTicks; \
|
---|
1011 | if ((pProfile2)->cTicksMin > Prefix##_cTicks) \
|
---|
1012 | (pProfile2)->cTicksMin = Prefix##_cTicks; \
|
---|
1013 | } \
|
---|
1014 | } \
|
---|
1015 | } while (0)
|
---|
1016 | #else
|
---|
1017 | # define STAM_REL_PROFILE_ADV_STOP_EX(pProfileAdv, pProfile2, Prefix) do { } while (0)
|
---|
1018 | #endif
|
---|
1019 | /** @def STAM_PROFILE_ADV_STOP_EX
|
---|
1020 | * Samples the stop time of a profiling period (if running) and updates both
|
---|
1021 | * the sample and an attribution sample.
|
---|
1022 | *
|
---|
1023 | * @param pProfileAdv Pointer to the STAMPROFILEADV structure to operate on.
|
---|
1024 | * @param pProfile2 Pointer to the STAMPROFILE structure which this
|
---|
1025 | * interval should be attributed to as well. This may be NULL.
|
---|
1026 | * @param Prefix Identifier prefix used to internal variables.
|
---|
1027 | */
|
---|
1028 | #ifdef VBOX_WITH_STATISTICS
|
---|
1029 | # define STAM_PROFILE_ADV_STOP_EX(pProfileAdv, pProfile2, Prefix) STAM_REL_PROFILE_ADV_STOP_EX(pProfileAdv, pProfile2, Prefix)
|
---|
1030 | #else
|
---|
1031 | # define STAM_PROFILE_ADV_STOP_EX(pProfileAdv, pProfile2, Prefix) do { } while (0)
|
---|
1032 | #endif
|
---|
1033 |
|
---|
1034 | /** @def STAM_REL_PROFILE_ADV_IS_RUNNING
|
---|
1035 | * Checks if it is running.
|
---|
1036 | *
|
---|
1037 | * @param pProfileAdv Pointer to the STAMPROFILEADV structure to operate on.
|
---|
1038 | */
|
---|
1039 | #ifndef VBOX_WITHOUT_RELEASE_STATISTICS
|
---|
1040 | # define STAM_REL_PROFILE_ADV_IS_RUNNING(pProfileAdv) (pProfileAdv)->tsStart
|
---|
1041 | #else
|
---|
1042 | # define STAM_REL_PROFILE_ADV_IS_RUNNING(pProfileAdv) (false)
|
---|
1043 | #endif
|
---|
1044 | /** @def STAM_PROFILE_ADV_IS_RUNNING
|
---|
1045 | * Checks if it is running.
|
---|
1046 | *
|
---|
1047 | * @param pProfileAdv Pointer to the STAMPROFILEADV structure to operate on.
|
---|
1048 | */
|
---|
1049 | #ifdef VBOX_WITH_STATISTICS
|
---|
1050 | # define STAM_PROFILE_ADV_IS_RUNNING(pProfileAdv) STAM_REL_PROFILE_ADV_IS_RUNNING(pProfileAdv)
|
---|
1051 | #else
|
---|
1052 | # define STAM_PROFILE_ADV_IS_RUNNING(pProfileAdv) (false)
|
---|
1053 | #endif
|
---|
1054 |
|
---|
1055 | /** @def STAM_REL_PROFILE_ADV_SET_STOPPED
|
---|
1056 | * Marks the profile counter as stopped.
|
---|
1057 | *
|
---|
1058 | * This is for avoiding screwups in twisty code.
|
---|
1059 | *
|
---|
1060 | * @param pProfileAdv Pointer to the STAMPROFILEADV structure to operate on.
|
---|
1061 | */
|
---|
1062 | #ifndef VBOX_WITHOUT_RELEASE_STATISTICS
|
---|
1063 | # define STAM_REL_PROFILE_ADV_SET_STOPPED(pProfileAdv) do { (pProfileAdv)->tsStart = 0; } while (0)
|
---|
1064 | #else
|
---|
1065 | # define STAM_REL_PROFILE_ADV_SET_STOPPED(pProfileAdv) do { } while (0)
|
---|
1066 | #endif
|
---|
1067 | /** @def STAM_PROFILE_ADV_SET_STOPPED
|
---|
1068 | * Marks the profile counter as stopped.
|
---|
1069 | *
|
---|
1070 | * This is for avoiding screwups in twisty code.
|
---|
1071 | *
|
---|
1072 | * @param pProfileAdv Pointer to the STAMPROFILEADV structure to operate on.
|
---|
1073 | */
|
---|
1074 | #ifdef VBOX_WITH_STATISTICS
|
---|
1075 | # define STAM_PROFILE_ADV_SET_STOPPED(pProfileAdv) STAM_REL_PROFILE_ADV_SET_STOPPED(pProfileAdv)
|
---|
1076 | #else
|
---|
1077 | # define STAM_PROFILE_ADV_SET_STOPPED(pProfileAdv) do { } while (0)
|
---|
1078 | #endif
|
---|
1079 |
|
---|
1080 |
|
---|
1081 | /**
|
---|
1082 | * Ratio of A to B, uint32_t types.
|
---|
1083 | * @remark Use STAM_STATS or STAM_REL_STATS for modifying A & B values.
|
---|
1084 | */
|
---|
1085 | typedef struct STAMRATIOU32
|
---|
1086 | {
|
---|
1087 | /** Sample A. */
|
---|
1088 | uint32_t volatile u32A;
|
---|
1089 | /** Sample B. */
|
---|
1090 | uint32_t volatile u32B;
|
---|
1091 | } STAMRATIOU32;
|
---|
1092 | /** Pointer to a uint32_t ratio. */
|
---|
1093 | typedef STAMRATIOU32 *PSTAMRATIOU32;
|
---|
1094 | /** Pointer to const a uint32_t ratio. */
|
---|
1095 | typedef const STAMRATIOU32 *PCSTAMRATIOU32;
|
---|
1096 |
|
---|
1097 |
|
---|
1098 |
|
---|
1099 |
|
---|
1100 | /** @defgroup grp_stam_r3 The STAM Host Context Ring 3 API
|
---|
1101 | * @{
|
---|
1102 | */
|
---|
1103 |
|
---|
1104 | VMMR3DECL(int) STAMR3InitUVM(PUVM pUVM);
|
---|
1105 | VMMR3DECL(void) STAMR3TermUVM(PUVM pUVM);
|
---|
1106 | VMMR3DECL(int) STAMR3RegisterU(PUVM pUVM, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
|
---|
1107 | const char *pszName, STAMUNIT enmUnit, const char *pszDesc);
|
---|
1108 | VMMR3DECL(int) STAMR3Register(PVM pVM, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
|
---|
1109 | const char *pszName, STAMUNIT enmUnit, const char *pszDesc);
|
---|
1110 |
|
---|
1111 | /** @def STAM_REL_REG
|
---|
1112 | * Registers a statistics sample.
|
---|
1113 | *
|
---|
1114 | * @param pVM VM Handle.
|
---|
1115 | * @param pvSample Pointer to the sample.
|
---|
1116 | * @param enmType Sample type. This indicates what pvSample is pointing at.
|
---|
1117 | * @param pszName Sample name. The name is on this form "/<component>/<sample>".
|
---|
1118 | * Further nesting is possible.
|
---|
1119 | * @param enmUnit Sample unit.
|
---|
1120 | * @param pszDesc Sample description.
|
---|
1121 | */
|
---|
1122 | #define STAM_REL_REG(pVM, pvSample, enmType, pszName, enmUnit, pszDesc) \
|
---|
1123 | STAM_REL_STATS({ int rcStam = STAMR3Register(pVM, pvSample, enmType, STAMVISIBILITY_ALWAYS, pszName, enmUnit, pszDesc); \
|
---|
1124 | AssertRC(rcStam); })
|
---|
1125 | /** @def STAM_REG
|
---|
1126 | * Registers a statistics sample if statistics are enabled.
|
---|
1127 | *
|
---|
1128 | * @param pVM VM Handle.
|
---|
1129 | * @param pvSample Pointer to the sample.
|
---|
1130 | * @param enmType Sample type. This indicates what pvSample is pointing at.
|
---|
1131 | * @param pszName Sample name. The name is on this form "/<component>/<sample>".
|
---|
1132 | * Further nesting is possible.
|
---|
1133 | * @param enmUnit Sample unit.
|
---|
1134 | * @param pszDesc Sample description.
|
---|
1135 | */
|
---|
1136 | #define STAM_REG(pVM, pvSample, enmType, pszName, enmUnit, pszDesc) \
|
---|
1137 | STAM_STATS({STAM_REL_REG(pVM, pvSample, enmType, pszName, enmUnit, pszDesc);})
|
---|
1138 |
|
---|
1139 | /** @def STAM_REL_REG_USED
|
---|
1140 | * Registers a statistics sample which only shows when used.
|
---|
1141 | *
|
---|
1142 | * @param pVM VM Handle.
|
---|
1143 | * @param pvSample Pointer to the sample.
|
---|
1144 | * @param enmType Sample type. This indicates what pvSample is pointing at.
|
---|
1145 | * @param pszName Sample name. The name is on this form "/<component>/<sample>".
|
---|
1146 | * Further nesting is possible.
|
---|
1147 | * @param enmUnit Sample unit.
|
---|
1148 | * @param pszDesc Sample description.
|
---|
1149 | */
|
---|
1150 | #define STAM_REL_REG_USED(pVM, pvSample, enmType, pszName, enmUnit, pszDesc) \
|
---|
1151 | STAM_REL_STATS({ int rcStam = STAMR3Register(pVM, pvSample, enmType, STAMVISIBILITY_USED, pszName, enmUnit, pszDesc); \
|
---|
1152 | AssertRC(rcStam);})
|
---|
1153 | /** @def STAM_REG_USED
|
---|
1154 | * Registers a statistics sample which only shows when used, if statistics are enabled.
|
---|
1155 | *
|
---|
1156 | * @param pVM VM Handle.
|
---|
1157 | * @param pvSample Pointer to the sample.
|
---|
1158 | * @param enmType Sample type. This indicates what pvSample is pointing at.
|
---|
1159 | * @param pszName Sample name. The name is on this form "/<component>/<sample>".
|
---|
1160 | * Further nesting is possible.
|
---|
1161 | * @param enmUnit Sample unit.
|
---|
1162 | * @param pszDesc Sample description.
|
---|
1163 | */
|
---|
1164 | #define STAM_REG_USED(pVM, pvSample, enmType, pszName, enmUnit, pszDesc) \
|
---|
1165 | STAM_STATS({ STAM_REL_REG_USED(pVM, pvSample, enmType, pszName, enmUnit, pszDesc); })
|
---|
1166 |
|
---|
1167 | VMMR3DECL(int) STAMR3RegisterFU(PUVM pUVM, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility, STAMUNIT enmUnit,
|
---|
1168 | const char *pszDesc, const char *pszName, ...) RT_IPRT_FORMAT_ATTR(7, 8);
|
---|
1169 | VMMR3DECL(int) STAMR3RegisterF(PVM pVM, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility, STAMUNIT enmUnit,
|
---|
1170 | const char *pszDesc, const char *pszName, ...) RT_IPRT_FORMAT_ATTR(7, 8);
|
---|
1171 | VMMR3DECL(int) STAMR3RegisterVU(PUVM pUVM, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility, STAMUNIT enmUnit,
|
---|
1172 | const char *pszDesc, const char *pszName, va_list args) RT_IPRT_FORMAT_ATTR(7, 0);
|
---|
1173 | VMMR3DECL(int) STAMR3RegisterV(PVM pVM, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility, STAMUNIT enmUnit,
|
---|
1174 | const char *pszDesc, const char *pszName, va_list args) RT_IPRT_FORMAT_ATTR(7, 0);
|
---|
1175 |
|
---|
1176 | /**
|
---|
1177 | * Resets the sample.
|
---|
1178 | * @param pVM The VM handle.
|
---|
1179 | * @param pvSample The sample registered using STAMR3RegisterCallback.
|
---|
1180 | */
|
---|
1181 | typedef void FNSTAMR3CALLBACKRESET(PVM pVM, void *pvSample);
|
---|
1182 | /** Pointer to a STAM sample reset callback. */
|
---|
1183 | typedef FNSTAMR3CALLBACKRESET *PFNSTAMR3CALLBACKRESET;
|
---|
1184 |
|
---|
1185 | /**
|
---|
1186 | * Prints the sample into the buffer.
|
---|
1187 | *
|
---|
1188 | * @param pVM The VM handle.
|
---|
1189 | * @param pvSample The sample registered using STAMR3RegisterCallback.
|
---|
1190 | * @param pszBuf The buffer to print into.
|
---|
1191 | * @param cchBuf The size of the buffer.
|
---|
1192 | */
|
---|
1193 | typedef void FNSTAMR3CALLBACKPRINT(PVM pVM, void *pvSample, char *pszBuf, size_t cchBuf);
|
---|
1194 | /** Pointer to a STAM sample print callback. */
|
---|
1195 | typedef FNSTAMR3CALLBACKPRINT *PFNSTAMR3CALLBACKPRINT;
|
---|
1196 |
|
---|
1197 | VMMR3DECL(int) STAMR3RegisterCallback(PVM pVM, void *pvSample, STAMVISIBILITY enmVisibility, STAMUNIT enmUnit,
|
---|
1198 | PFNSTAMR3CALLBACKRESET pfnReset, PFNSTAMR3CALLBACKPRINT pfnPrint,
|
---|
1199 | const char *pszDesc, const char *pszName, ...) RT_IPRT_FORMAT_ATTR(8, 9);
|
---|
1200 | VMMR3DECL(int) STAMR3RegisterCallbackV(PVM pVM, void *pvSample, STAMVISIBILITY enmVisibility, STAMUNIT enmUnit,
|
---|
1201 | PFNSTAMR3CALLBACKRESET pfnReset, PFNSTAMR3CALLBACKPRINT pfnPrint,
|
---|
1202 | const char *pszDesc, const char *pszName, va_list args) RT_IPRT_FORMAT_ATTR(8, 0);
|
---|
1203 | VMMR3DECL(int) STAMR3Deregister(PUVM pUVM, const char *pszPat);
|
---|
1204 | VMMR3DECL(int) STAMR3DeregisterF(PUVM pUVM, const char *pszPatFmt, ...) RT_IPRT_FORMAT_ATTR(2, 3);
|
---|
1205 | VMMR3DECL(int) STAMR3DeregisterV(PUVM pUVM, const char *pszPatFmt, va_list va) RT_IPRT_FORMAT_ATTR(2, 0);
|
---|
1206 | VMMR3DECL(int) STAMR3DeregisterByAddr(PUVM pUVM, void *pvSample);
|
---|
1207 |
|
---|
1208 | VMMR3DECL(int) STAMR3Reset(PUVM pUVM, const char *pszPat);
|
---|
1209 | VMMR3DECL(int) STAMR3Snapshot(PUVM pUVM, const char *pszPat, char **ppszSnapshot, size_t *pcchSnapshot, bool fWithDesc);
|
---|
1210 | VMMR3DECL(int) STAMR3SnapshotFree(PUVM pUVM, char *pszSnapshot);
|
---|
1211 | VMMR3DECL(int) STAMR3Dump(PUVM pUVM, const char *pszPat);
|
---|
1212 | VMMR3DECL(int) STAMR3DumpToReleaseLog(PUVM pUVM, const char *pszPat);
|
---|
1213 | VMMR3DECL(int) STAMR3Print(PUVM pUVM, const char *pszPat);
|
---|
1214 |
|
---|
1215 | /**
|
---|
1216 | * Callback function for STAMR3Enum().
|
---|
1217 | *
|
---|
1218 | * @returns non-zero to halt the enumeration.
|
---|
1219 | *
|
---|
1220 | * @param pszName The name of the sample.
|
---|
1221 | * @param enmType The type.
|
---|
1222 | * @param pvSample Pointer to the data. enmType indicates the format of this data.
|
---|
1223 | * @param enmUnit The unit.
|
---|
1224 | * @param enmVisibility The visibility.
|
---|
1225 | * @param pszDesc The description.
|
---|
1226 | * @param pvUser The pvUser argument given to STAMR3Enum().
|
---|
1227 | */
|
---|
1228 | typedef DECLCALLBACK(int) FNSTAMR3ENUM(const char *pszName, STAMTYPE enmType, void *pvSample, STAMUNIT enmUnit,
|
---|
1229 | STAMVISIBILITY enmVisiblity, const char *pszDesc, void *pvUser);
|
---|
1230 | /** Pointer to a FNSTAMR3ENUM(). */
|
---|
1231 | typedef FNSTAMR3ENUM *PFNSTAMR3ENUM;
|
---|
1232 |
|
---|
1233 | VMMR3DECL(int) STAMR3Enum(PUVM pUVM, const char *pszPat, PFNSTAMR3ENUM pfnEnum, void *pvUser);
|
---|
1234 | VMMR3DECL(const char *) STAMR3GetUnit(STAMUNIT enmUnit);
|
---|
1235 |
|
---|
1236 | /** @} */
|
---|
1237 |
|
---|
1238 | /** @} */
|
---|
1239 |
|
---|
1240 | RT_C_DECLS_END
|
---|
1241 |
|
---|
1242 | #endif
|
---|
1243 |
|
---|