VirtualBox

Changeset 5456 in vbox for trunk/include/iprt/time.h


Ignore:
Timestamp:
Oct 24, 2007 1:04:51 AM (17 years ago)
Author:
vboxsync
Message:

New RTTimeNanoTS/GIP code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/time.h

    r4734 r5456  
    684684 * Debugging the time api.
    685685 *
    686  * @returns the number of 1ns steps which has been applied by rtTimeNanoTSInternal().
    687  */
    688 RTDECL(uint32_t) RTTime1nsSteps(void);
     686 * @returns the number of 1ns steps which has been applied by RTTimeNanoTS().
     687 */
     688RTDECL(uint32_t) RTTimeDbgSteps(void);
     689
     690/**
     691 * Debugging the time api.
     692 *
     693 * @returns the number of times the TSC interval expired RTTimeNanoTS().
     694 */
     695RTDECL(uint32_t) RTTimeDbgExpired(void);
     696
     697/**
     698 * Debugging the time api.
     699 *
     700 * @returns the number of bad previous values encountered by RTTimeNanoTS().
     701 */
     702RTDECL(uint32_t) RTTimeDbgBad(void);
     703
     704/**
     705 * Debugging the time api.
     706 *
     707 * @returns the number of update races in RTTimeNanoTS().
     708 */
     709RTDECL(uint32_t) RTTimeDbgRaces(void);
     710
     711/** @name RTTimeNanoTS GIP worker functions, for TM.
     712 * @{ */
     713/** Pointer to a RTTIMENANOTSDATA structure. */
     714typedef struct RTTIMENANOTSDATA *PRTTIMENANOTSDATA;
     715
     716/**
     717 * Nanosecond timestamp data.
     718 *
     719 * This is used to keep track of statistics and callback so IPRT
     720 * and TM (VirtualBox) can share code.
     721 *
     722 * @remark Keep this in sync with the assembly version in timesupA.asm.
     723 */
     724typedef struct RTTIMENANOTSDATA
     725{
     726    /** Where the previous timestamp is stored.
     727     * This is maintained to ensure that time doesn't go backwards or anything. */
     728    uint64_t volatile   u64Prev;
     729    /** Number of 1ns steps because of overshooting the period. */
     730    uint32_t            c1nsSteps;
     731    /** The number of times the interval expired (overflow). */
     732    uint32_t            cExpired;
     733    /** Number of "bad" previous values. */
     734    uint32_t            cBadPrev;
     735    /** The number of update races. */
     736    uint32_t            cUpdateRaces;
     737
     738    /**
     739     * Helper function that's used by the assembly routines when something goes bust.
     740     *
     741     * @param   pData           Pointer to this structure.
     742     * @param   u64NanoTS       The calculated nano ts.
     743     * @param   u64DeltaPrev    The delta relative to the previously returned timestamp.
     744     * @param   u64PrevNanoTS   The previously returned timestamp (as it was read it).
     745     */
     746    DECLCALLBACKMEMBER(void, pfnBad)(PRTTIMENANOTSDATA pData, uint64_t u64NanoTS, uint64_t u64DeltaPrev, uint64_t u64PrevNanoTS);
     747
     748    /**
     749     * Callback for when rediscovery is required.
     750     *
     751     * @returns Nanosecond timestamp.
     752     * @param   pData           Pointer to this structure.
     753     */
     754    DECLCALLBACKMEMBER(uint64_t, pfnRediscover)(PRTTIMENANOTSDATA pData);
     755} RTTIMENANOTSDATA;
     756
     757/** Internal RTTimeNanoTS worker (assembly). */
     758typedef DECLCALLBACK(uint64_t) FNTIMENANOTSINTERNAL(PRTTIMENANOTSDATA pData);
     759/** Pointer to an internal RTTimeNanoTS worker (assembly). */
     760typedef FNTIMENANOTSINTERNAL *PFNTIMENANOTSINTERNAL;
     761
     762RTDECL(uint64_t) RTTimeNanoTSLegacySync(PRTTIMENANOTSDATA pData);
     763RTDECL(uint64_t) RTTimeNanoTSLegacyAsync(PRTTIMENANOTSDATA pData);
     764RTDECL(uint64_t) RTTimeNanoTSLFenceSync(PRTTIMENANOTSDATA pData);
     765RTDECL(uint64_t) RTTimeNanoTSLFenceAsync(PRTTIMENANOTSDATA pData);
     766/** @} */
     767
    689768
    690769/**
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