VirtualBox

source: vbox/trunk/include/VBox/stam.h@ 7581

Last change on this file since 7581 was 6796, checked in by vboxsync, 17 years ago

Fixed init problems wrt. VM ownership by implementing the UVM structure (U = user mode) and moving problematic ring-3 stuff over there (emt+reqs, r3heap, stam, loader[VMMR0.r0]). Big change, but it works fine here... :-)

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette