VirtualBox

Changeset 73639 in vbox for trunk/src/VBox/ValidationKit


Ignore:
Timestamp:
Aug 13, 2018 3:00:49 PM (6 years ago)
Author:
vboxsync
Message:

ValidationKit/SerialTest: Increase the timestamp resolution to avoid division by 0 errors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/utils/serial/SerialTest.cpp

    r72031 r73639  
    381381static DECLCALLBACK(int) serialTestRunReadWrite(PSERIALTEST pSerialTest)
    382382{
    383     uint64_t tsStart = RTTimeMilliTS();
     383    uint64_t tsStart = RTTimeNanoTS();
    384384    bool fFailed = false;
    385385    SERIALTESTTXRXBUFCNT SerBufTx;
     
    423423    }
    424424
    425     uint64_t tsRuntime = RTTimeMilliTS() - tsStart;
    426     tsRuntime /= 1000; /* Seconds */
    427     RTTestValue(pSerialTest->hTest, "Throughput", g_cbTx / tsRuntime, RTTESTUNIT_BYTES_PER_SEC);
     425    uint64_t tsRuntime = RTTimeNanoTS() - tsStart;
     426    size_t cNsPerByte = tsRuntime / g_cbTx;
     427    uint64_t cbBytesPerSec = RT_NS_1SEC / cNsPerByte;
     428    RTTestValue(pSerialTest->hTest, "Throughput", cbBytesPerSec, RTTESTUNIT_BYTES_PER_SEC);
    428429
    429430    return rc;
     
    439440static DECLCALLBACK(int) serialTestRunWrite(PSERIALTEST pSerialTest)
    440441{
    441     uint64_t tsStart = RTTimeMilliTS();
     442    uint64_t tsStart = RTTimeNanoTS();
    442443    SERIALTESTTXRXBUFCNT SerBufTx;
    443444
     
    458459    }
    459460
    460     uint64_t tsRuntime = RTTimeMilliTS() - tsStart;
    461     tsRuntime /= 1000; /* Seconds */
    462     RTTestValue(pSerialTest->hTest, "Throughput", g_cbTx / tsRuntime, RTTESTUNIT_BYTES_PER_SEC);
     461    uint64_t tsRuntime = RTTimeNanoTS() - tsStart;
     462    size_t cNsPerByte = tsRuntime / g_cbTx;
     463    uint64_t cbBytesPerSec = RT_NS_1SEC / cNsPerByte;
     464    RTTestValue(pSerialTest->hTest, "Throughput", cbBytesPerSec, RTTESTUNIT_BYTES_PER_SEC);
    463465
    464466    return rc;
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