Changeset 21840 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Jul 28, 2009 1:31:08 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 50470
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/testcase/tstCompressionBenchmark.cpp
r21816 r21840 109 109 { "--page-at-a-time", 'c', RTGETOPT_REQ_UINT32 }, 110 110 { "--page-file", 'f', RTGETOPT_REQ_STRING }, 111 { "--offset", 'o', RTGETOPT_REQ_UINT64 }, 112 { "--page-offset", 'O', RTGETOPT_REQ_UINT64 }, 111 113 }; 112 114 113 115 const char *pszPageFile = NULL; 116 uint64_t offPageFile = 0; 114 117 uint32_t cIterations = 1; 115 118 uint32_t cPagesAtATime = 1; … … 145 148 case 'f': 146 149 pszPageFile = Val.psz; 150 break; 151 152 case 'o': 153 offPageFile = Val.u64; 154 break; 155 156 case 'O': 157 offPageFile = Val.u64 * PAGE_SIZE; 147 158 break; 148 159 … … 179 190 { 180 191 size_t cbFile; 181 rc = RTFileReadAllEx(pszPageFile, 0, g_cbPages, RTFILE_RDALL_O_DENY_NONE, (void **)&g_pabSrc, &cbFile);192 rc = RTFileReadAllEx(pszPageFile, offPageFile, g_cbPages, RTFILE_RDALL_O_DENY_NONE, (void **)&g_pabSrc, &cbFile); 182 193 if (RT_FAILURE(rc)) 183 return Error("Error reading %zu bytes from %s : %Rrc\n", g_cbPages, pszPageFile, rc);194 return Error("Error reading %zu bytes from %s at %llu: %Rrc\n", g_cbPages, pszPageFile, offPageFile, rc); 184 195 if (cbFile != g_cbPages) 185 return Error("Error reading %zu bytes from %s : got %zu bytes\n", g_cbPages, pszPageFile, cbFile);196 return Error("Error reading %zu bytes from %s at %llu: got %zu bytes\n", g_cbPages, pszPageFile, offPageFile, cbFile); 186 197 } 187 198 else … … 226 237 /** The size of the compressed data. */ 227 238 uint64_t cbCompr; 228 /** Number of errrors. */229 uint32_t cErrors;239 /** First error. */ 240 int rc; 230 241 /** The compression style: block or stream. */ 231 242 bool fBlock; … … 238 249 } aTests[] = 239 250 { 240 { 0, 0, 0, 0, false, RTZIPTYPE_STORE, RTZIPLEVEL_DEFAULT, "RTZip/Store" }, 241 { 0, 0, 0, 0, false, RTZIPTYPE_LZF, RTZIPLEVEL_DEFAULT, "RTZip/LZF" }, 242 // { 0, 0, 0, 0, false, RTZIPTYPE_ZLIB, RTZIPLEVEL_DEFAULT, "RTZip/zlib" }, - slow plus it randomly hits VERR_GENERAL_FAILURE atm. 243 { 0, 0, 0, 0, true, RTZIPTYPE_STORE, RTZIPLEVEL_DEFAULT, "RTZipBlock/Store" }, 244 { 0, 0, 0, 0, true, RTZIPTYPE_LZF, RTZIPLEVEL_DEFAULT, "RTZipBlock/LZF" }, 245 // { 0, 0, 0, 0, true, RTZIPTYPE_LZJB, RTZIPLEVEL_DEFAULT, "RTZipBlock/LZJB" }, 251 { 0, 0, 0, VINF_SUCCESS, false, RTZIPTYPE_STORE, RTZIPLEVEL_DEFAULT, "RTZip/Store" }, 252 { 0, 0, 0, VINF_SUCCESS, false, RTZIPTYPE_LZF, RTZIPLEVEL_DEFAULT, "RTZip/LZF" }, 253 /* { 0, 0, 0, VINF_SUCCESS, false, RTZIPTYPE_ZLIB, RTZIPLEVEL_DEFAULT, "RTZip/zlib" }, - slow plus it randomly hits VERR_GENERAL_FAILURE atm. */ 254 { 0, 0, 0, VINF_SUCCESS, true, RTZIPTYPE_STORE, RTZIPLEVEL_DEFAULT, "RTZipBlock/Store" }, 255 { 0, 0, 0, VINF_SUCCESS, true, RTZIPTYPE_LZF, RTZIPLEVEL_DEFAULT, "RTZipBlock/LZF" }, 256 { 0, 0, 0, VINF_SUCCESS, true, RTZIPTYPE_LZJB, RTZIPLEVEL_DEFAULT, "RTZipBlock/LZJB" }, 257 { 0, 0, 0, VINF_SUCCESS, true, RTZIPTYPE_LZO, RTZIPLEVEL_DEFAULT, "RTZipBlock/LZO" }, 246 258 }; 247 259 RTPrintf("tstCompressionBenchmark: TESTING.."); … … 250 262 for (uint32_t j = 0; j < RT_ELEMENTS(aTests); j++) 251 263 { 264 if (RT_FAILURE(aTests[j].rc)) 265 continue; 252 266 memset(g_pabCompr, 0, g_cbComprAlloc); 253 267 memset(g_pabDecompr, 0, g_cbPages); … … 279 293 { 280 294 Error("RTZipBlockCompress failed for '%s' (#%u): %Rrc\n", aTests[j].pszName, j, rc); 281 aTests[j]. cErrors++;295 aTests[j].rc = rc; 282 296 break; 283 297 } … … 298 312 { 299 313 Error("Failed to create the compressor for '%s' (#%u): %Rrc\n", aTests[j].pszName, j, rc); 300 aTests[j]. cErrors++;314 aTests[j].rc = rc; 301 315 continue; 302 316 } … … 310 324 { 311 325 Error("RTZipCompress failed for '%s' (#%u): %Rrc\n", aTests[j].pszName, j, rc); 312 aTests[j]. cErrors++;326 aTests[j].rc = rc; 313 327 break; 314 328 } … … 321 335 { 322 336 Error("RTZipCompFinish failed for '%s' (#%u): %Rrc\n", aTests[j].pszName, j, rc); 323 aTests[j]. cErrors++;337 aTests[j].rc = rc; 324 338 break; 325 339 } … … 351 365 { 352 366 Error("RTZipBlockDecompress failed for '%s' (#%u): %Rrc\n", aTests[j].pszName, j, rc); 353 aTests[j]. cErrors++;367 aTests[j].rc = rc; 354 368 break; 355 369 } … … 368 382 { 369 383 Error("Failed to create the decompressor for '%s' (#%u): %Rrc\n", aTests[j].pszName, j, rc); 370 aTests[j]. cErrors++;384 aTests[j].rc = rc; 371 385 continue; 372 386 } … … 380 394 { 381 395 Error("RTZipDecompress failed for '%s' (#%u): %Rrc\n", aTests[j].pszName, j, rc); 382 aTests[j]. cErrors++;396 aTests[j].rc = rc; 383 397 break; 384 398 } … … 395 409 { 396 410 Error("The compressed data doesn't match the source for '%s' (%#u)\n", aTests[j].pszName, j); 397 aTests[j]. cErrors++;411 aTests[j].rc = VERR_BAD_EXE_FORMAT; 398 412 continue; 399 413 } … … 413 427 for (uint32_t j = 0; j < RT_ELEMENTS(aTests); j++) 414 428 { 415 if ( !aTests[j].cErrors)429 if (RT_SUCCESS(aTests[j].rc)) 416 430 { 417 431 unsigned uComprSpeedIn = (unsigned)(cbTotalKB / (long double)aTests[j].cNanoCompr * 1000000000.0); … … 434 448 else 435 449 { 436 RTPrintf("%-20s: % u errors\n", aTests[j].pszName, aTests[j].cErrors);450 RTPrintf("%-20s: %Rrc\n", aTests[j].pszName, aTests[j].rc); 437 451 rc = 1; 438 452 } 439 453 } 440 RTPrintf("Input: %'12zu pages (%'zu bytes)\n", g_cPages, g_cbPages); 454 if (pszPageFile) 455 RTPrintf("Input: %'10zu pages from '%s' starting at offset %'lld (%#llx)\n" 456 " %'11zu bytes\n", 457 g_cPages, pszPageFile, offPageFile, offPageFile, g_cbPages); 458 else 459 RTPrintf("Input: %'10zu pages of generated rubbish %'11zu bytes\n", 460 g_cPages, g_cbPages); 441 461 RTPrintf("tstCompressionBenchmark: END RESULTS\n"); 442 462
Note:
See TracChangeset
for help on using the changeset viewer.