VirtualBox

Changeset 88661 in vbox for trunk/include/VBox/vmm


Ignore:
Timestamp:
Apr 22, 2021 6:22:55 PM (4 years ago)
Author:
vboxsync
Message:

STAM: Added macros for recording nanoseconds in STAMPROFILE (using RTTimeNanoTS). bugref:9890

File:
1 edited

Legend:

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

    r87263 r88661  
    801801
    802802
     803/** @def STAM_REL_PROFILE_START_NS
     804 * Samples the start time of a profiling period, using RTTimeNanoTS().
     805 *
     806 * @param   pProfile    Pointer to the STAMPROFILE structure to operate on.
     807 * @param   Prefix      Identifier prefix used to internal variables.
     808 *
     809 * @remarks Declears a stack variable that will be used by related macros.
     810 */
     811#ifndef VBOX_WITHOUT_RELEASE_STATISTICS
     812# define STAM_REL_PROFILE_START_NS(pProfile, Prefix) \
     813    uint64_t const Prefix##_tsStart = RTTimeNanoTS()
     814#else
     815# define STAM_REL_PROFILE_START_NS(pProfile, Prefix) do { } while (0)
     816#endif
     817/** @def STAM_PROFILE_START_NS
     818 * Samples the start time of a profiling period, using RTTimeNanoTS().
     819 *
     820 * @param   pProfile    Pointer to the STAMPROFILE structure to operate on.
     821 * @param   Prefix      Identifier prefix used to internal variables.
     822 *
     823 * @remarks Declears a stack variable that will be used by related macros.
     824 */
     825#ifdef VBOX_WITH_STATISTICS
     826# define STAM_PROFILE_START_NS(pProfile, Prefix) STAM_REL_PROFILE_START_NS(pProfile, Prefix)
     827#else
     828# define STAM_PROFILE_START_NS(pProfile, Prefix) do { } while (0)
     829#endif
     830
     831/** @def STAM_REL_PROFILE_STOP_NS
     832 * Samples the stop time of a profiling period and updates the sample, using
     833 * RTTimeNanoTS().
     834 *
     835 * @param   pProfile    Pointer to the STAMPROFILE structure to operate on.
     836 * @param   Prefix      Identifier prefix used to internal variables.
     837 */
     838#ifndef VBOX_WITHOUT_RELEASE_STATISTICS
     839# define STAM_REL_PROFILE_STOP_NS(pProfile, Prefix) \
     840    STAM_REL_PROFILE_ADD_PERIOD(pProfile, RTTimeNanoTS() - Prefix##_tsStart)
     841#else
     842# define STAM_REL_PROFILE_STOP_NS(pProfile, Prefix) do { } while (0)
     843#endif
     844/** @def STAM_PROFILE_STOP_NS
     845 * Samples the stop time of a profiling period and updates the sample, using
     846 * RTTimeNanoTS().
     847 *
     848 * @param   pProfile    Pointer to the STAMPROFILE structure to operate on.
     849 * @param   Prefix      Identifier prefix used to internal variables.
     850 */
     851#ifdef VBOX_WITH_STATISTICS
     852# define STAM_PROFILE_STOP_NS(pProfile, Prefix) STAM_REL_PROFILE_STOP_NS(pProfile, Prefix)
     853#else
     854# define STAM_PROFILE_STOP_NS(pProfile, Prefix) do { } while (0)
     855#endif
     856
     857
    803858/**
    804859 * Advanced profiling sample - STAMTYPE_PROFILE_ADV.
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