Changeset 43445 in vbox for trunk/src/VBox/Main/testcase/tstCollector.cpp
- Timestamp:
- Sep 27, 2012 8:28:59 AM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 80964
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/testcase/tstCollector.cpp
r38636 r43445 142 142 } 143 143 144 int testNetwork(pm::CollectorHAL *collector) 145 { 146 pm::CollectorHints hints; 147 uint64_t hostRxStart, hostTxStart, speedStart; 148 uint64_t hostRxStop, hostTxStop, speedStop; 149 150 RTPrintf("\ntstCollector: TESTING - Network load, sleeping for 5 sec...\n"); 151 152 int rc = collector->preCollect(hints, 0); 153 if (RT_FAILURE(rc)) 154 { 155 RTPrintf("tstCollector: preCollect() -> %Rrc\n", rc); 156 return 1; 157 } 158 rc = collector->getRawHostNetworkLoad("eth0", &hostRxStart, &hostTxStart, &speedStart); 159 if (RT_FAILURE(rc)) 160 { 161 RTPrintf("tstCollector: getRawHostNetworkLoad() -> %Rrc\n", rc); 162 return 1; 163 } 164 165 RTThreadSleep(5000); // Sleep for five seconds 166 167 rc = collector->preCollect(hints, 0); 168 if (RT_FAILURE(rc)) 169 { 170 RTPrintf("tstCollector: preCollect() -> %Rrc\n", rc); 171 return 1; 172 } 173 rc = collector->getRawHostNetworkLoad("eth0", &hostRxStop, &hostTxStop, &speedStop); 174 if (RT_FAILURE(rc)) 175 { 176 RTPrintf("tstCollector: getRawHostNetworkLoad() -> %Rrc\n", rc); 177 return 1; 178 } 179 if (speedStart != speedStop) 180 RTPrintf("tstCollector: getRawHostNetworkLoad() returned different bandwidth (%llu != %llu)\n", speedStart, speedStop); 181 RTPrintf("tstCollector: host network speed = %llu bytes/sec (%llu mbit/sec)\n", 182 speedStop, speedStop/(1000000/8)); 183 RTPrintf("tstCollector: host network rx = %llu bytes/sec (%llu mbit/sec, %d %%*100)\n", 184 (hostRxStop - hostRxStart)/5, (hostRxStop - hostRxStart)/(5000000/8), 185 (hostRxStop - hostRxStart) * 10000 / (speedStop * 5)); 186 RTPrintf("tstCollector: host network tx = %llu bytes/sec (%llu mbit/sec, %d %%*100)\n", 187 (hostTxStop - hostTxStart)/5, (hostTxStop - hostTxStart)/(5000000/8), 188 (hostTxStop - hostTxStart) * 10000 / (speedStop * 5)); 189 190 return 0; 191 } 192 144 193 int main(int argc, char *argv[]) 145 194 { … … 320 369 RTPrintf("tstCollector: process mem used = %lu kB\n", processUsed); 321 370 #endif 371 #if 1 372 rc = testNetwork(collector); 373 #endif 374 #if 0 322 375 RTPrintf("\ntstCollector: TESTING - Performance\n\n"); 323 376 324 377 measurePerformance(collector, argv[0], 100); 378 #endif 325 379 326 380 delete collector;
Note:
See TracChangeset
for help on using the changeset viewer.