VirtualBox

source: vbox/trunk/src/VBox/VMM/STAMInternal.h@ 8851

Last change on this file since 8851 was 8155, checked in by vboxsync, 17 years ago

The Big Sun Rebranding Header Change

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.9 KB
Line 
1/* $Id: STAMInternal.h 8155 2008-04-18 15:16:47Z vboxsync $ */
2/** @file
3 * STAM Internal Header.
4 */
5
6/*
7 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18 * Clara, CA 95054 USA or visit http://www.sun.com if you need
19 * additional information or have any questions.
20 */
21
22#ifndef ___STAMInternal_h
23#define ___STAMInternal_h
24
25#include <VBox/cdefs.h>
26#include <VBox/types.h>
27#include <VBox/stam.h>
28#include <VBox/gvmm.h>
29#include <iprt/semaphore.h>
30
31#if !defined(IN_STAM_R3) && !defined(IN_STAM_R0) && !defined(IN_STAM_GC)
32# error "Not in STAM! This is an internal header!"
33#endif
34
35
36__BEGIN_DECLS
37
38/** @defgroup grp_stam_int Internals
39 * @ingroup grp_stam
40 * @internal
41 * @{
42 */
43
44/**
45 * Sample descriptor.
46 */
47typedef struct STAMDESC
48{
49 /** Pointer to the next sample. */
50 struct STAMDESC *pNext;
51 /** Sample name. */
52 const char *pszName;
53 /** Sample type. */
54 STAMTYPE enmType;
55 /** Visibility type. */
56 STAMVISIBILITY enmVisibility;
57 /** Pointer to the sample data. */
58 union STAMDESCSAMPLEDATA
59 {
60 /** Counter. */
61 PSTAMCOUNTER pCounter;
62 /** Profile. */
63 PSTAMPROFILE pProfile;
64 /** Advanced profile. */
65 PSTAMPROFILEADV pProfileAdv;
66 /** Ratio, unsigned 32-bit. */
67 PSTAMRATIOU32 pRatioU32;
68 /** unsigned 8-bit. */
69 uint8_t *pu8;
70 /** unsigned 16-bit. */
71 uint16_t *pu16;
72 /** unsigned 32-bit. */
73 uint32_t *pu32;
74 /** unsigned 64-bit. */
75 uint64_t *pu64;
76 /** Simple void pointer. */
77 void *pv;
78 /** */
79 struct STAMDESCSAMPLEDATACALLBACKS
80 {
81 /** The same pointer. */
82 void *pvSample;
83 /** Pointer to the reset callback. */
84 PFNSTAMR3CALLBACKRESET pfnReset;
85 /** Pointer to the print callback. */
86 PFNSTAMR3CALLBACKPRINT pfnPrint;
87 } Callback;
88 } u;
89 /** Unit. */
90 STAMUNIT enmUnit;
91 /** Description. */
92 const char *pszDesc;
93} STAMDESC;
94/** Pointer to sample descriptor. */
95typedef STAMDESC *PSTAMDESC;
96/** Pointer to const sample descriptor. */
97typedef const STAMDESC *PCSTAMDESC;
98
99
100/**
101 * STAM data kept in the UVM.
102 */
103typedef struct STAMUSERPERVM
104{
105 /** Pointer to the first sample. */
106 R3PTRTYPE(PSTAMDESC) pHead;
107 /** RW Lock for the list. */
108 RTSEMRW RWSem;
109
110 /** The copy of the GVMM statistics. */
111 GVMMSTATS GVMMStats;
112} STAMUSERPERVM;
113/** Pointer to the STAM data kept in the UVM. */
114typedef STAMUSERPERVM *PSTAMUSERPERVM;
115
116
117/** Locks the sample descriptors for reading. */
118#define STAM_LOCK_RD(pUVM) do { int rcSem = RTSemRWRequestRead(pUVM->stam.s.RWSem, RT_INDEFINITE_WAIT); AssertRC(rcSem); } while (0)
119/** Locks the sample descriptors for writing. */
120#define STAM_LOCK_WR(pUVM) do { int rcSem = RTSemRWRequestWrite(pUVM->stam.s.RWSem, RT_INDEFINITE_WAIT); AssertRC(rcSem); } while (0)
121/** UnLocks the sample descriptors after reading. */
122#define STAM_UNLOCK_RD(pUVM) do { int rcSem = RTSemRWReleaseRead(pUVM->stam.s.RWSem); AssertRC(rcSem); } while (0)
123/** UnLocks the sample descriptors after writing. */
124#define STAM_UNLOCK_WR(pUVM) do { int rcSem = RTSemRWReleaseWrite(pUVM->stam.s.RWSem); AssertRC(rcSem); } while (0)
125
126/** @} */
127
128__END_DECLS
129
130#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