VirtualBox

Changeset 88088 in vbox


Ignore:
Timestamp:
Mar 11, 2021 1:05:43 PM (4 years ago)
Author:
vboxsync
Message:

VMM/TM: Try make sure the load doesn't exceed 100% after the switch from RTTimeNanoTS to RDTSC for the execute part. bugref:9941

File:
1 edited

Legend:

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

    r88076 r88088  
    35663566    /* Calc & update deltas */
    35673567    uint64_t cNsTotalDelta      = cNsTotal     - pState->cNsPrevTotal;
     3568    uint64_t cNsExecutingDelta  = cNsExecuting - pState->cNsPrevExecuting;
     3569    uint64_t cNsHaltedDelta     = cNsHalted    - pState->cNsPrevHalted;
     3570
     3571    if (cNsExecutingDelta + cNsHaltedDelta <= cNsTotalDelta)
     3572    { /* likely */ }
     3573    else
     3574    {
     3575        /* Just adjust the executing and halted values down to match the total delta. */
     3576        uint64_t const cNsExecAndHalted = cNsExecutingDelta + cNsHaltedDelta;
     3577        uint64_t const cNsAdjust        = cNsExecAndHalted - cNsTotalDelta + cNsTotalDelta / 64;
     3578        cNsExecutingDelta -= (cNsAdjust * cNsExecutingDelta + cNsExecAndHalted - 1) / cNsExecAndHalted;
     3579        cNsHaltedDelta    -= (cNsAdjust * cNsHaltedDelta    + cNsExecAndHalted - 1) / cNsExecAndHalted;
     3580        Assert(cNsExecutingDelta + cNsHaltedDelta <= cNsTotalDelta);
     3581    }
     3582
     3583    pState->cNsPrevExecuting    = cNsExecuting;
     3584    pState->cNsPrevHalted       = cNsHalted;
    35683585    pState->cNsPrevTotal        = cNsTotal;
    3569 
    3570     uint64_t cNsExecutingDelta  = cNsExecuting - pState->cNsPrevExecuting;
    3571     pState->cNsPrevExecuting    = cNsExecuting;
    3572 
    3573     uint64_t cNsHaltedDelta     = cNsHalted    - pState->cNsPrevHalted;
    3574     pState->cNsPrevHalted       = cNsHalted;
    35753586
    35763587    /* Calc pcts. */
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