VirtualBox

vbox的更動 56529 路徑 trunk/src/VBox/Storage


忽略:
時間撮記:
2015-6-18 下午03:15:17 (9 年 以前)
作者:
vboxsync
訊息:

tstVDIo: Change the implementation to calculate the throughput in KB/s. Before it would return ~(uint64_t)0 on at least one testbox causing Out of Range errors with the SQL database when inserting that value and returning stale data in the web interface. The current approach while still not very sophisticated should avoid that and the error margin introduced is far below the normal fluctuations during the tests

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Storage/testcase/tstVDIo.cpp

    r55083 r56529  
    668668}
    669669
     670/**
     671 * Returns the speed in KB/s from the amount of and the time in nanoseconds it
     672 * took to complete the test.
     673 *
     674 * @returns Speed in KB/s
     675 * @param   cbIo     Size of the I/O test
     676 * @param   tsNano   Time in nanoseconds it took to complete the test.
     677 */
     678static uint64_t tstVDIoGetSpeedKBs(uint64_t cbIo, uint64_t tsNano)
     679{
     680    /*
     681     * Blow up the value until we can do the calculation without getting 0 as
     682     * a result.
     683     */
     684    uint64_t cbIoTemp = cbIo;
     685    uint64_t uSpeedKBs;
     686    unsigned cRounds = 0;
     687    while (cbIoTemp < tsNano)
     688    {
     689        cbIoTemp *= 1000;
     690        cRounds++;
     691    }
     692
     693    uSpeedKBs = ((cbIoTemp / tsNano) * RT_NS_1SEC) / 1024;
     694
     695    while (cRounds-- > 0)
     696        uSpeedKBs /= 1000;
     697
     698    return uSpeedKBs;
     699}
     700
    670701static DECLCALLBACK(int) vdScriptHandlerIo(PVDSCRIPTARG paScriptArgs, void *pvUser)
    671702{
     
    955986
    956987                NanoTS = RTTimeNanoTS() - NanoTS;
    957                 uint64_t SpeedKBs = (uint64_t)(cbIo / (NanoTS / 1000000000.0) / 1024);
     988                uint64_t SpeedKBs = tstVDIoGetSpeedKBs(cbIo, NanoTS);
    958989                RTTestValue(pGlob->hTest, "Throughput", SpeedKBs, RTTESTUNIT_KILOBYTES_PER_SEC);
    959990
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette