VirtualBox

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

Last change on this file since 18770 was 12989, checked in by vboxsync, 16 years ago

VMM + VBox/cdefs.h: consolidated all the XYZ*DECLS of the VMM into VMM*DECL. Removed dead DECL and IN_XYZ* macros.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.8 KB
Line 
1/* $Id: STAMInternal.h 12989 2008-10-06 02:15:39Z 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
32
33__BEGIN_DECLS
34
35/** @defgroup grp_stam_int Internals
36 * @ingroup grp_stam
37 * @internal
38 * @{
39 */
40
41/**
42 * Sample descriptor.
43 */
44typedef struct STAMDESC
45{
46 /** Pointer to the next sample. */
47 struct STAMDESC *pNext;
48 /** Sample name. */
49 const char *pszName;
50 /** Sample type. */
51 STAMTYPE enmType;
52 /** Visibility type. */
53 STAMVISIBILITY enmVisibility;
54 /** Pointer to the sample data. */
55 union STAMDESCSAMPLEDATA
56 {
57 /** Counter. */
58 PSTAMCOUNTER pCounter;
59 /** Profile. */
60 PSTAMPROFILE pProfile;
61 /** Advanced profile. */
62 PSTAMPROFILEADV pProfileAdv;
63 /** Ratio, unsigned 32-bit. */
64 PSTAMRATIOU32 pRatioU32;
65 /** unsigned 8-bit. */
66 uint8_t *pu8;
67 /** unsigned 16-bit. */
68 uint16_t *pu16;
69 /** unsigned 32-bit. */
70 uint32_t *pu32;
71 /** unsigned 64-bit. */
72 uint64_t *pu64;
73 /** Simple void pointer. */
74 void *pv;
75 /** */
76 struct STAMDESCSAMPLEDATACALLBACKS
77 {
78 /** The same pointer. */
79 void *pvSample;
80 /** Pointer to the reset callback. */
81 PFNSTAMR3CALLBACKRESET pfnReset;
82 /** Pointer to the print callback. */
83 PFNSTAMR3CALLBACKPRINT pfnPrint;
84 } Callback;
85 } u;
86 /** Unit. */
87 STAMUNIT enmUnit;
88 /** Description. */
89 const char *pszDesc;
90} STAMDESC;
91/** Pointer to sample descriptor. */
92typedef STAMDESC *PSTAMDESC;
93/** Pointer to const sample descriptor. */
94typedef const STAMDESC *PCSTAMDESC;
95
96
97/**
98 * STAM data kept in the UVM.
99 */
100typedef struct STAMUSERPERVM
101{
102 /** Pointer to the first sample. */
103 R3PTRTYPE(PSTAMDESC) pHead;
104 /** RW Lock for the list. */
105 RTSEMRW RWSem;
106
107 /** The copy of the GVMM statistics. */
108 GVMMSTATS GVMMStats;
109} STAMUSERPERVM;
110/** Pointer to the STAM data kept in the UVM. */
111typedef STAMUSERPERVM *PSTAMUSERPERVM;
112
113
114/** Locks the sample descriptors for reading. */
115#define STAM_LOCK_RD(pUVM) do { int rcSem = RTSemRWRequestRead(pUVM->stam.s.RWSem, RT_INDEFINITE_WAIT); AssertRC(rcSem); } while (0)
116/** Locks the sample descriptors for writing. */
117#define STAM_LOCK_WR(pUVM) do { int rcSem = RTSemRWRequestWrite(pUVM->stam.s.RWSem, RT_INDEFINITE_WAIT); AssertRC(rcSem); } while (0)
118/** UnLocks the sample descriptors after reading. */
119#define STAM_UNLOCK_RD(pUVM) do { int rcSem = RTSemRWReleaseRead(pUVM->stam.s.RWSem); AssertRC(rcSem); } while (0)
120/** UnLocks the sample descriptors after writing. */
121#define STAM_UNLOCK_WR(pUVM) do { int rcSem = RTSemRWReleaseWrite(pUVM->stam.s.RWSem); AssertRC(rcSem); } while (0)
122
123/** @} */
124
125__END_DECLS
126
127#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