VirtualBox

Changeset 92387 in vbox


Ignore:
Timestamp:
Nov 12, 2021 12:38:14 AM (3 years ago)
Author:
vboxsync
Message:

VMM/STAM: New STAMUNIT_BYTES_PER_CALL unit. Improved the formatting of profile stats - may cause incorrect statistics to be discovered.

Location:
trunk
Files:
2 edited

Legend:

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

    r90834 r92387  
    202202    /** Count of bytes. */
    203203    STAMUNIT_BYTES,
     204    /** Count of bytes per call. */
     205    STAMUNIT_BYTES_PER_CALL,
    204206    /** Count of bytes. */
    205207    STAMUNIT_PAGES,
     
    13141316VMMR3DECL(int)  STAMR3Enum(PUVM pUVM, const char *pszPat, PFNSTAMR3ENUM pfnEnum, void *pvUser);
    13151317VMMR3DECL(const char *) STAMR3GetUnit(STAMUNIT enmUnit);
     1318VMMR3DECL(const char *) STAMR3GetUnit1(STAMUNIT enmUnit);
     1319VMMR3DECL(const char *) STAMR3GetUnit2(STAMUNIT enmUnit);
    13161320
    13171321/** @} */
  • trunk/src/VBox/VMM/VMMR3/STAM.cpp

    r85121 r92387  
    24622462
    24632463            uint64_t u64 = pDesc->u.pProfile->cPeriods ? pDesc->u.pProfile->cPeriods : 1;
    2464             pArgs->pfnPrintf(pArgs, "%-32s %8llu %s (%12llu ticks, %7llu times, max %9llu, min %7lld)\n", pDesc->pszName,
     2464            pArgs->pfnPrintf(pArgs, "%-32s %8llu %s (%12llu %s, %7llu %s, max %9llu, min %7lld)\n", pDesc->pszName,
    24652465                             pDesc->u.pProfile->cTicks / u64, STAMR3GetUnit(pDesc->enmUnit),
    2466                              pDesc->u.pProfile->cTicks, pDesc->u.pProfile->cPeriods, pDesc->u.pProfile->cTicksMax, pDesc->u.pProfile->cTicksMin);
     2466                             pDesc->u.pProfile->cTicks, STAMR3GetUnit1(pDesc->enmUnit),
     2467                             pDesc->u.pProfile->cPeriods, STAMR3GetUnit2(pDesc->enmUnit),
     2468                             pDesc->u.pProfile->cTicksMax, pDesc->u.pProfile->cTicksMin);
    24672469            break;
    24682470        }
     
    30003002        case STAMUNIT_COUNT:                return "count";
    30013003        case STAMUNIT_BYTES:                return "bytes";
     3004        case STAMUNIT_BYTES_PER_CALL:       return "bytes/call";
    30023005        case STAMUNIT_PAGES:                return "pages";
    30033006        case STAMUNIT_ERRORS:               return "errors";
     
    30213024}
    30223025
     3026
     3027/**
     3028 * For something per something-else unit, get the first something.
     3029 *
     3030 * @returns Pointer to read only unit string.
     3031 * @param   enmUnit     The unit.
     3032 */
     3033VMMR3DECL(const char *) STAMR3GetUnit1(STAMUNIT enmUnit)
     3034{
     3035    switch (enmUnit)
     3036    {
     3037        case STAMUNIT_NONE:                 return "";
     3038        case STAMUNIT_CALLS:                return "calls";
     3039        case STAMUNIT_COUNT:                return "count";
     3040        case STAMUNIT_BYTES:                return "bytes";
     3041        case STAMUNIT_BYTES_PER_CALL:       return "bytes";
     3042        case STAMUNIT_PAGES:                return "pages";
     3043        case STAMUNIT_ERRORS:               return "errors";
     3044        case STAMUNIT_OCCURENCES:           return "times";
     3045        case STAMUNIT_TICKS:                return "ticks";
     3046        case STAMUNIT_TICKS_PER_CALL:       return "ticks";
     3047        case STAMUNIT_TICKS_PER_OCCURENCE:  return "ticks";
     3048        case STAMUNIT_GOOD_BAD:             return "good";
     3049        case STAMUNIT_MEGABYTES:            return "megabytes";
     3050        case STAMUNIT_KILOBYTES:            return "kilobytes";
     3051        case STAMUNIT_NS:                   return "ns";
     3052        case STAMUNIT_NS_PER_CALL:          return "ns";
     3053        case STAMUNIT_NS_PER_OCCURENCE:     return "ns";
     3054        case STAMUNIT_PCT:                  return "%";
     3055        case STAMUNIT_HZ:                   return "Hz";
     3056
     3057        default:
     3058            AssertMsgFailed(("Unknown unit %d\n", enmUnit));
     3059            return "(?unit?)";
     3060    }
     3061}
     3062
     3063
     3064/**
     3065 * For something per something-else unit, get the something-else.
     3066 *
     3067 * @returns Pointer to read only unit string.
     3068 * @param   enmUnit     The unit.
     3069 */
     3070VMMR3DECL(const char *) STAMR3GetUnit2(STAMUNIT enmUnit)
     3071{
     3072    switch (enmUnit)
     3073    {
     3074        case STAMUNIT_TICKS_PER_CALL:       return "calls";
     3075        case STAMUNIT_NS_PER_CALL:          return "calls";
     3076        case STAMUNIT_BYTES_PER_CALL:       return "calls";
     3077        case STAMUNIT_TICKS_PER_OCCURENCE:  return "times";
     3078        case STAMUNIT_NS_PER_OCCURENCE:     return "times";
     3079        case STAMUNIT_NONE:                 return "times";
     3080        case STAMUNIT_GOOD_BAD:             return "bad";
     3081        default:
     3082            AssertMsgFailed(("Wrong unit %d\n", enmUnit));
     3083            return "times";
     3084    }
     3085}
     3086
    30233087#ifdef VBOX_WITH_DEBUGGER
    30243088
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