VirtualBox

Ignore:
Timestamp:
Oct 2, 2012 1:22:31 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
81089
Message:

Main/Metrics: Alternative way to get link speed for old kernels (#6345)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/testcase/tstCollector.cpp

    r43445 r43507  
    145145{
    146146    pm::CollectorHints hints;
    147     uint64_t hostRxStart, hostTxStart, speedStart;
    148     uint64_t hostRxStop, hostTxStop, speedStop;
     147    uint64_t hostRxStart, hostTxStart;
     148    uint64_t hostRxStop, hostTxStop, speed = 125000000; /* Assume 1Gbit/s */
    149149
    150150    RTPrintf("\ntstCollector: TESTING - Network load, sleeping for 5 sec...\n");
     
    156156        return 1;
    157157    }
    158     rc = collector->getRawHostNetworkLoad("eth0", &hostRxStart, &hostTxStart, &speedStart);
     158    rc = collector->getRawHostNetworkLoad("eth0", &hostRxStart, &hostTxStart);
    159159    if (RT_FAILURE(rc))
    160160    {
     
    171171        return 1;
    172172    }
    173     rc = collector->getRawHostNetworkLoad("eth0", &hostRxStop, &hostTxStop, &speedStop);
     173    rc = collector->getRawHostNetworkLoad("eth0", &hostRxStop, &hostTxStop);
    174174    if (RT_FAILURE(rc))
    175175    {
     
    177177        return 1;
    178178    }
    179     if (speedStart != speedStop)
    180         RTPrintf("tstCollector: getRawHostNetworkLoad() returned different bandwidth (%llu != %llu)\n", speedStart, speedStop);
    181179    RTPrintf("tstCollector: host network speed = %llu bytes/sec (%llu mbit/sec)\n",
    182              speedStop, speedStop/(1000000/8));
     180             speed, speed/(1000000/8));
    183181    RTPrintf("tstCollector: host network rx    = %llu bytes/sec (%llu mbit/sec, %d %%*100)\n",
    184182             (hostRxStop - hostRxStart)/5, (hostRxStop - hostRxStart)/(5000000/8),
    185              (hostRxStop - hostRxStart) * 10000 / (speedStop * 5));
     183             (hostRxStop - hostRxStart) * 10000 / (speed * 5));
    186184    RTPrintf("tstCollector: host network tx    = %llu bytes/sec (%llu mbit/sec, %d %%*100)\n",
    187185             (hostTxStop - hostTxStart)/5, (hostTxStop - hostTxStart)/(5000000/8),
    188              (hostTxStop - hostTxStart) * 10000 / (speedStop * 5));
     186             (hostTxStop - hostTxStart) * 10000 / (speed * 5));
    189187
    190188    return 0;
Note: See TracChangeset for help on using the changeset viewer.

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