VirtualBox

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

Last change on this file since 43529 was 39947, checked in by vboxsync, 13 years ago

STAM: alignment fix (32-bit + gcc).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.0 KB
Line 
1/* $Id: STAMInternal.h 39947 2012-02-02 00:48:42Z vboxsync $ */
2/** @file
3 * STAM Internal Header.
4 */
5
6/*
7 * Copyright (C) 2006-2007 Oracle Corporation
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
18#ifndef ___STAMInternal_h
19#define ___STAMInternal_h
20
21#include <VBox/cdefs.h>
22#include <VBox/types.h>
23#include <VBox/vmm/stam.h>
24#include <VBox/vmm/gvmm.h>
25#include <VBox/vmm/gmm.h>
26#include <iprt/semaphore.h>
27
28
29
30RT_C_DECLS_BEGIN
31
32/** @defgroup grp_stam_int Internals
33 * @ingroup grp_stam
34 * @internal
35 * @{
36 */
37
38/**
39 * Sample descriptor.
40 */
41typedef struct STAMDESC
42{
43 /** Pointer to the next sample. */
44 struct STAMDESC *pNext;
45 /** Sample name. */
46 const char *pszName;
47 /** Sample type. */
48 STAMTYPE enmType;
49 /** Visibility type. */
50 STAMVISIBILITY enmVisibility;
51 /** Pointer to the sample data. */
52 union STAMDESCSAMPLEDATA
53 {
54 /** Counter. */
55 PSTAMCOUNTER pCounter;
56 /** Profile. */
57 PSTAMPROFILE pProfile;
58 /** Advanced profile. */
59 PSTAMPROFILEADV pProfileAdv;
60 /** Ratio, unsigned 32-bit. */
61 PSTAMRATIOU32 pRatioU32;
62 /** unsigned 8-bit. */
63 uint8_t *pu8;
64 /** unsigned 16-bit. */
65 uint16_t *pu16;
66 /** unsigned 32-bit. */
67 uint32_t *pu32;
68 /** unsigned 64-bit. */
69 uint64_t *pu64;
70 /** Simple void pointer. */
71 void *pv;
72 /** Boolean. */
73 bool *pf;
74 /** */
75 struct STAMDESCSAMPLEDATACALLBACKS
76 {
77 /** The same pointer. */
78 void *pvSample;
79 /** Pointer to the reset callback. */
80 PFNSTAMR3CALLBACKRESET pfnReset;
81 /** Pointer to the print callback. */
82 PFNSTAMR3CALLBACKPRINT pfnPrint;
83 } Callback;
84 } u;
85 /** Unit. */
86 STAMUNIT enmUnit;
87 /** Description. */
88 const char *pszDesc;
89} STAMDESC;
90/** Pointer to sample descriptor. */
91typedef STAMDESC *PSTAMDESC;
92/** Pointer to const sample descriptor. */
93typedef const STAMDESC *PCSTAMDESC;
94
95
96/**
97 * STAM data kept in the UVM.
98 */
99typedef struct STAMUSERPERVM
100{
101 /** Pointer to the first sample. */
102 R3PTRTYPE(PSTAMDESC) pHead;
103 /** RW Lock for the list. */
104 RTSEMRW RWSem;
105
106 /** The copy of the GVMM statistics. */
107 GVMMSTATS GVMMStats;
108 /** The number of registered host CPU leaves. */
109 uint32_t cRegisteredHostCpus;
110
111 /** Explicit alignment padding. */
112 uint32_t uAlignment;
113 /** The copy of the GMM statistics. */
114 GMMSTATS GMMStats;
115} STAMUSERPERVM;
116AssertCompileMemberAlignment(STAMUSERPERVM, GMMStats, 8);
117
118/** Pointer to the STAM data kept in the UVM. */
119typedef STAMUSERPERVM *PSTAMUSERPERVM;
120
121
122/** Locks the sample descriptors for reading. */
123#define STAM_LOCK_RD(pUVM) do { int rcSem = RTSemRWRequestRead(pUVM->stam.s.RWSem, RT_INDEFINITE_WAIT); AssertRC(rcSem); } while (0)
124/** Locks the sample descriptors for writing. */
125#define STAM_LOCK_WR(pUVM) do { int rcSem = RTSemRWRequestWrite(pUVM->stam.s.RWSem, RT_INDEFINITE_WAIT); AssertRC(rcSem); } while (0)
126/** UnLocks the sample descriptors after reading. */
127#define STAM_UNLOCK_RD(pUVM) do { int rcSem = RTSemRWReleaseRead(pUVM->stam.s.RWSem); AssertRC(rcSem); } while (0)
128/** UnLocks the sample descriptors after writing. */
129#define STAM_UNLOCK_WR(pUVM) do { int rcSem = RTSemRWReleaseWrite(pUVM->stam.s.RWSem); AssertRC(rcSem); } while (0)
130
131/** @} */
132
133RT_C_DECLS_END
134
135#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