VirtualBox

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

Last change on this file since 8098 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 Id
File size: 3.7 KB
Line 
1/* $Id: STAMInternal.h 6796 2008-02-04 18:19:58Z vboxsync $ */
2/** @file
3 * STAM Internal Header.
4 */
5
6/*
7 * Copyright (C) 2006-2007 innotek GmbH
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/stam.h>
24#include <VBox/gvmm.h>
25#include <iprt/semaphore.h>
26
27#if !defined(IN_STAM_R3) && !defined(IN_STAM_R0) && !defined(IN_STAM_GC)
28# error "Not in STAM! This is an internal header!"
29#endif
30
31
32__BEGIN_DECLS
33
34/** @defgroup grp_stam_int Internals
35 * @ingroup grp_stam
36 * @internal
37 * @{
38 */
39
40/**
41 * Sample descriptor.
42 */
43typedef struct STAMDESC
44{
45 /** Pointer to the next sample. */
46 struct STAMDESC *pNext;
47 /** Sample name. */
48 const char *pszName;
49 /** Sample type. */
50 STAMTYPE enmType;
51 /** Visibility type. */
52 STAMVISIBILITY enmVisibility;
53 /** Pointer to the sample data. */
54 union STAMDESCSAMPLEDATA
55 {
56 /** Counter. */
57 PSTAMCOUNTER pCounter;
58 /** Profile. */
59 PSTAMPROFILE pProfile;
60 /** Advanced profile. */
61 PSTAMPROFILEADV pProfileAdv;
62 /** Ratio, unsigned 32-bit. */
63 PSTAMRATIOU32 pRatioU32;
64 /** unsigned 8-bit. */
65 uint8_t *pu8;
66 /** unsigned 16-bit. */
67 uint16_t *pu16;
68 /** unsigned 32-bit. */
69 uint32_t *pu32;
70 /** unsigned 64-bit. */
71 uint64_t *pu64;
72 /** Simple void pointer. */
73 void *pv;
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} STAMUSERPERVM;
109/** Pointer to the STAM data kept in the UVM. */
110typedef STAMUSERPERVM *PSTAMUSERPERVM;
111
112
113/** Locks the sample descriptors for reading. */
114#define STAM_LOCK_RD(pUVM) do { int rcSem = RTSemRWRequestRead(pUVM->stam.s.RWSem, RT_INDEFINITE_WAIT); AssertRC(rcSem); } while (0)
115/** Locks the sample descriptors for writing. */
116#define STAM_LOCK_WR(pUVM) do { int rcSem = RTSemRWRequestWrite(pUVM->stam.s.RWSem, RT_INDEFINITE_WAIT); AssertRC(rcSem); } while (0)
117/** UnLocks the sample descriptors after reading. */
118#define STAM_UNLOCK_RD(pUVM) do { int rcSem = RTSemRWReleaseRead(pUVM->stam.s.RWSem); AssertRC(rcSem); } while (0)
119/** UnLocks the sample descriptors after writing. */
120#define STAM_UNLOCK_WR(pUVM) do { int rcSem = RTSemRWReleaseWrite(pUVM->stam.s.RWSem); AssertRC(rcSem); } while (0)
121
122/** @} */
123
124__END_DECLS
125
126#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