VirtualBox

Changeset 13598 in vbox


Ignore:
Timestamp:
Oct 27, 2008 7:36:49 PM (16 years ago)
Author:
vboxsync
Message:

#1865: STAM - minor cleanups.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/stam.h

    r12989 r13598  
    967967 */
    968968
    969 VMMR3DECL(int) STAMR3InitUVM(PUVM pUVM);
     969VMMR3DECL(int)  STAMR3InitUVM(PUVM pUVM);
    970970VMMR3DECL(void) STAMR3TermUVM(PUVM pUVM);
    971 VMMR3DECL(int) STAMR3RegisterU(PUVM pUVM, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
     971VMMR3DECL(int)  STAMR3RegisterU(PUVM pUVM, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
    972972                                const char *pszName, STAMUNIT enmUnit, const char *pszDesc);
    973 VMMR3DECL(int) STAMR3Register(PVM pVM, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
     973VMMR3DECL(int)  STAMR3Register(PVM pVM, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
    974974                               const char *pszName, STAMUNIT enmUnit, const char *pszDesc);
    975975
     
    10861086    STAM_STATS({ STAM_REL_DEREG(pVM, pvSample); })
    10871087
    1088 VMMR3DECL(int) STAMR3ResetU(PUVM pUVM, const char *pszPat);
    1089 VMMR3DECL(int) STAMR3Reset(PVM pVM, const char *pszPat);
    1090 VMMR3DECL(int) STAMR3SnapshotU(PUVM pUVM, const char *pszPat, char **ppszSnapshot, size_t *pcchSnapshot, bool fWithDesc);
    1091 VMMR3DECL(int) STAMR3Snapshot(PVM pVM, const char *pszPat, char **ppszSnapshot, size_t *pcchSnapshot, bool fWithDesc);
    1092 VMMR3DECL(int) STAMR3SnapshotFreeU(PUVM pUVM, char *pszSnapshot);
    1093 VMMR3DECL(int) STAMR3SnapshotFree(PVM pVM, char *pszSnapshot);
    1094 VMMR3DECL(int) STAMR3DumpU(PUVM pUVM, const char *pszPat);
    1095 VMMR3DECL(int) STAMR3Dump(PVM pVM, const char *pszPat);
    1096 VMMR3DECL(int) STAMR3DumpToReleaseLogU(PUVM pUVM, const char *pszPat);
    1097 VMMR3DECL(int) STAMR3DumpToReleaseLog(PVM pVM, const char *pszPat);
    1098 VMMR3DECL(int) STAMR3PrintU(PUVM pUVM, const char *pszPat);
    1099 VMMR3DECL(int) STAMR3Print(PVM pVM, const char *pszPat);
     1088VMMR3DECL(int)  STAMR3ResetU(PUVM pUVM, const char *pszPat);
     1089VMMR3DECL(int)  STAMR3Reset(PVM pVM, const char *pszPat);
     1090VMMR3DECL(int)  STAMR3SnapshotU(PUVM pUVM, const char *pszPat, char **ppszSnapshot, size_t *pcchSnapshot, bool fWithDesc);
     1091VMMR3DECL(int)  STAMR3Snapshot(PVM pVM, const char *pszPat, char **ppszSnapshot, size_t *pcchSnapshot, bool fWithDesc);
     1092VMMR3DECL(int)  STAMR3SnapshotFreeU(PUVM pUVM, char *pszSnapshot);
     1093VMMR3DECL(int)  STAMR3SnapshotFree(PVM pVM, char *pszSnapshot);
     1094VMMR3DECL(int)  STAMR3DumpU(PUVM pUVM, const char *pszPat);
     1095VMMR3DECL(int)  STAMR3Dump(PVM pVM, const char *pszPat);
     1096VMMR3DECL(int)  STAMR3DumpToReleaseLogU(PUVM pUVM, const char *pszPat);
     1097VMMR3DECL(int)  STAMR3DumpToReleaseLog(PVM pVM, const char *pszPat);
     1098VMMR3DECL(int)  STAMR3PrintU(PUVM pUVM, const char *pszPat);
     1099VMMR3DECL(int)  STAMR3Print(PVM pVM, const char *pszPat);
    11001100
    11011101/**
     
    11171117typedef FNSTAMR3ENUM *PFNSTAMR3ENUM;
    11181118
    1119 VMMR3DECL(int) STAMR3EnumU(PUVM pUVM, const char *pszPat, PFNSTAMR3ENUM pfnEnum, void *pvUser);
    1120 VMMR3DECL(int) STAMR3Enum(PVM pVM, const char *pszPat, PFNSTAMR3ENUM pfnEnum, void *pvUser);
     1119VMMR3DECL(int)  STAMR3EnumU(PUVM pUVM, const char *pszPat, PFNSTAMR3ENUM pfnEnum, void *pvUser);
     1120VMMR3DECL(int)  STAMR3Enum(PVM pVM, const char *pszPat, PFNSTAMR3ENUM pfnEnum, void *pvUser);
    11211121VMMR3DECL(const char *) STAMR3GetUnit(STAMUNIT enmUnit);
    11221122
     
    11281128
    11291129#endif
     1130
  • trunk/src/VBox/VMM/STAM.cpp

    r13477 r13598  
    2323 *
    2424 * The purpose for the statistics manager is to present the rest of the system
    25  * with a somewhat uniform way of accessing VMM statistics. STAM sports a couple
    26  * of different APIs for accessing them: STAMR3EnumU, STAMR3SnapshotU,
    27  * STAMR3DumpU, STAMR3DumpToReleaseLogU. Main is exposing the XML based one,
    28  * STAMR3SnapshotU.
     25 * with a somewhat uniform way of accessing VMM statistics.  STAM sports a
     26 * couple of different APIs for accessing them: STAMR3EnumU, STAMR3SnapshotU,
     27 * STAMR3DumpU, STAMR3DumpToReleaseLogU and the debugger.  Main is exposing the
     28 * XML based one, STAMR3SnapshotU.
    2929 *
    3030 * The rest of the VMM together with the devices and drivers registers their
    31  * statistics with STAM giving them a name. The name is like hierarchical, the
    32  * components separated by slashes ('/').
     31 * statistics with STAM giving them a name.  The name is hierarchical, the
     32 * components separated by slashes ('/') and must start with a slash.
     33 *
     34 * Each item registered with STAM - also, half incorrectly, called a sample -
     35 * has a type, unit, visibility, data pointer and description associated with it
     36 * in addition to the name (described above).  The type tells STAM what kind of
     37 * structure the pointer is pointing to.  The visibility allows unused
     38 * statistics from cluttering the output or showing up in the GUI.  All the bits
     39 * together makes STAM able to present the items in a sensible way to the user.
     40 * Some types also allows STAM to reset the data, which is very convenient when
     41 * digging into specific operations and such.
     42 *
     43 * PS. The VirtualBox Debugger GUI has a viewer for inspecting the statistics
     44 * STAM provides.  You will also find statistics in the release and debug logs.
     45 * And as mentioned in the introduction, the debugger console features a couple
     46 * of command: .stats and .statsreset.
    3347 *
    3448 * @see grp_stam
     
    123137*   Internal Functions                                                         *
    124138*******************************************************************************/
    125 static int stamR3RegisterU(PUVM pUVM, void *pvSample, PFNSTAMR3CALLBACKRESET pfnReset, PFNSTAMR3CALLBACKPRINT pfnPrint,
    126                            STAMTYPE enmType, STAMVISIBILITY enmVisibility, const char *pszName, STAMUNIT enmUnit, const char *pszDesc);
    127 static int stamR3ResetOne(PSTAMDESC pDesc, void *pvArg);
    128 static DECLCALLBACK(void) stamR3EnumLogPrintf(PSTAMR3PRINTONEARGS pvArg, const char *pszFormat, ...);
    129 static DECLCALLBACK(void) stamR3EnumRelLogPrintf(PSTAMR3PRINTONEARGS pvArg, const char *pszFormat, ...);
    130 static DECLCALLBACK(void) stamR3EnumPrintf(PSTAMR3PRINTONEARGS pvArg, const char *pszFormat, ...);
    131 static int stamR3SnapshotOne(PSTAMDESC pDesc, void *pvArg);
    132 static int stamR3SnapshotPrintf(PSTAMR3SNAPSHOTONE pThis, const char *pszFormat, ...);
    133 static int stamR3PrintOne(PSTAMDESC pDesc, void *pvArg);
    134 static int stamR3EnumOne(PSTAMDESC pDesc, void *pvArg);
    135 static bool stamR3MultiMatch(const char * const *papszExpressions, unsigned cExpressions, unsigned *piExpression, const char *pszName);
    136 static char **stamR3SplitPattern(const char *pszPat, unsigned *pcExpressions, char **ppszCopy);
    137 static int stamR3EnumU(PUVM pUVM, const char *pszPat, bool fUpdateRing0, int (pfnCallback)(PSTAMDESC pDesc, void *pvArg), void *pvArg);
    138 static void stamR3Ring0StatsRegisterU(PUVM pUVM);
    139 static void stamR3Ring0StatsUpdateU(PUVM pUVM, const char *pszPat);
    140 static void stamR3Ring0StatsUpdateMultiU(PUVM pUVM, const char * const *papszExpressions, unsigned cExpressions);
     139static int                  stamR3RegisterU(PUVM pUVM, void *pvSample, PFNSTAMR3CALLBACKRESET pfnReset, PFNSTAMR3CALLBACKPRINT pfnPrint,
     140                                            STAMTYPE enmType, STAMVISIBILITY enmVisibility, const char *pszName, STAMUNIT enmUnit, const char *pszDesc);
     141static int                  stamR3ResetOne(PSTAMDESC pDesc, void *pvArg);
     142static DECLCALLBACK(void)   stamR3EnumLogPrintf(PSTAMR3PRINTONEARGS pvArg, const char *pszFormat, ...);
     143static DECLCALLBACK(void)   stamR3EnumRelLogPrintf(PSTAMR3PRINTONEARGS pvArg, const char *pszFormat, ...);
     144static DECLCALLBACK(void)   stamR3EnumPrintf(PSTAMR3PRINTONEARGS pvArg, const char *pszFormat, ...);
     145static int                  stamR3SnapshotOne(PSTAMDESC pDesc, void *pvArg);
     146static int                  stamR3SnapshotPrintf(PSTAMR3SNAPSHOTONE pThis, const char *pszFormat, ...);
     147static int                  stamR3PrintOne(PSTAMDESC pDesc, void *pvArg);
     148static int                  stamR3EnumOne(PSTAMDESC pDesc, void *pvArg);
     149static bool                 stamR3MultiMatch(const char * const *papszExpressions, unsigned cExpressions, unsigned *piExpression, const char *pszName);
     150static char **              stamR3SplitPattern(const char *pszPat, unsigned *pcExpressions, char **ppszCopy);
     151static int                  stamR3EnumU(PUVM pUVM, const char *pszPat, bool fUpdateRing0, int (pfnCallback)(PSTAMDESC pDesc, void *pvArg), void *pvArg);
     152static void                 stamR3Ring0StatsRegisterU(PUVM pUVM);
     153static void                 stamR3Ring0StatsUpdateU(PUVM pUVM, const char *pszPat);
     154static void                 stamR3Ring0StatsUpdateMultiU(PUVM pUVM, const char * const *papszExpressions, unsigned cExpressions);
    141155
    142156#ifdef VBOX_WITH_DEBUGGER
    143 static DECLCALLBACK(int)  stamR3CmdStats(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs, PDBGCVAR pResult);
    144 static DECLCALLBACK(void) stamR3EnumDbgfPrintf(PSTAMR3PRINTONEARGS pArgs, const char *pszFormat, ...);
    145 static DECLCALLBACK(int)  stamR3CmdStatsReset(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs, PDBGCVAR pResult);
     157static DECLCALLBACK(int)    stamR3CmdStats(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs, PDBGCVAR pResult);
     158static DECLCALLBACK(void)   stamR3EnumDbgfPrintf(PSTAMR3PRINTONEARGS pArgs, const char *pszFormat, ...);
     159static DECLCALLBACK(int)    stamR3CmdStatsReset(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs, PDBGCVAR pResult);
    146160#endif
    147161
     
    773787    return STAMR3ResetU(pVM->pUVM, pszPat);
    774788}
    775 
    776789
    777790
     
    17931806}
    17941807
    1795 
    17961808#ifdef VBOX_WITH_DEBUGGER
     1809
    17971810/**
    17981811 * The '.stats' command.
     
    18811894    return pCmdHlp->pfnVBoxError(pCmdHlp, rc, "Restting statistics.\n");
    18821895}
    1883 #endif
    1884 
     1896
     1897#endif /* VBOX_WITH_DEBUGGER */
     1898
Note: See TracChangeset for help on using the changeset viewer.

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