MCPcopy Create free account
hub / github.com/google/snappy / MeasureFile

Function MeasureFile

snappy_test_tool.cc:418–452  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

416}
417
418void MeasureFile(const char* fname) {
419 std::string fullinput;
420 CHECK_OK(file::GetContents(fname, &fullinput, file::Defaults()));
421 std::printf("%-40s :\n", fname);
422
423 int start_len = (snappy::GetFlag(FLAGS_start_len) < 0)
424 ? fullinput.size()
425 : snappy::GetFlag(FLAGS_start_len);
426 int end_len = fullinput.size();
427 if (snappy::GetFlag(FLAGS_end_len) >= 0) {
428 end_len = std::min<int>(fullinput.size(), snappy::GetFlag(FLAGS_end_len));
429 }
430 for (int len = start_len; len <= end_len; ++len) {
431 const char* const input = fullinput.data();
432 int repeats = (snappy::GetFlag(FLAGS_bytes) + len) / (len + 1);
433 if (snappy::GetFlag(FLAGS_zlib))
434 Measure(input, len, ZLIB, repeats, 1024 << 10);
435 if (snappy::GetFlag(FLAGS_lzo))
436 Measure(input, len, LZO, repeats, 1024 << 10);
437 if (snappy::GetFlag(FLAGS_lz4))
438 Measure(input, len, LZ4, repeats, 1024 << 10);
439 if (snappy::GetFlag(FLAGS_snappy))
440 Measure(input, len, SNAPPY, repeats, 4096 << 10);
441
442 // For block-size based measurements
443 if (0 && snappy::GetFlag(FLAGS_snappy)) {
444 Measure(input, len, SNAPPY, repeats, 8<<10);
445 Measure(input, len, SNAPPY, repeats, 16<<10);
446 Measure(input, len, SNAPPY, repeats, 32<<10);
447 Measure(input, len, SNAPPY, repeats, 64<<10);
448 Measure(input, len, SNAPPY, repeats, 256<<10);
449 Measure(input, len, SNAPPY, repeats, 1024<<10);
450 }
451 }
452}
453
454} // namespace
455

Callers 1

mainFunction · 0.85

Calls 5

GetContentsFunction · 0.85
GetFlagFunction · 0.85
MeasureFunction · 0.85
sizeMethod · 0.80
dataMethod · 0.80

Tested by

no test coverage detected