VirtualBox

Changeset 69950 in vbox for trunk/src/VBox/VMM/VMMR3


Ignore:
Timestamp:
Dec 6, 2017 10:43:06 AM (7 years ago)
Author:
vboxsync
Message:

VMM/TMR3UtcNow: Log time changes between two calls larger than 30min.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/TM.cpp

    r69111 r69950  
    28102810VMMR3_INT_DECL(PRTTIMESPEC) TMR3UtcNow(PVM pVM, PRTTIMESPEC pTime)
    28112811{
    2812     /* Get a stable set of VirtualSync parameters before querying UTC. */
     2812    /*
     2813     * Get a stable set of VirtualSync parameters and calc the lag.
     2814     */
    28132815    uint64_t offVirtualSync;
    28142816    uint64_t offVirtualSyncGivenUp;
     
    28222824    uint64_t const offLag = offVirtualSync - offVirtualSyncGivenUp;
    28232825
     2826    /*
     2827     * Get current time and adjust for virtual sync lag and do time displacement.
     2828     */
    28242829    RTTimeNow(pTime);
    28252830    RTTimeSpecSubNano(pTime, offLag);
    28262831    RTTimeSpecAddNano(pTime, pVM->tm.s.offUTC);
     2832
     2833    /*
     2834     * Log details if the time changed radically (also triggers on first call).
     2835     */
     2836    int64_t nsPrev = ASMAtomicXchgS64(&pVM->tm.s.nsLastUtcNow, RTTimeSpecGetNano(pTime));
     2837    int64_t cNsDelta = RTTimeSpecGetNano(pTime) - nsPrev;
     2838    if (RT_ABS(cNsDelta) > RT_NS_1HOUR / 2)
     2839        LogRel(("TMR3UtcNow: nsNow=%RI64 nsPrev=%RI64 -> cNsDelta=%RI64 (offLag=%RI64 offVirtualSync=%RU64 offVirtualSyncGivenUp=%RU64)\n",
     2840                RTTimeSpecGetNano(pTime), nsPrev, cNsDelta, offLag, offVirtualSync, offVirtualSyncGivenUp));
     2841
    28272842    return pTime;
    28282843}
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