MCPcopy Create free account
hub / github.com/ElementsProject/elements / SnappyUncompress

Method SnappyUncompress

src/leveldb/benchmarks/db_bench.cc:658–678  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

656 }
657
658 void SnappyUncompress(ThreadState* thread) {
659 RandomGenerator gen;
660 Slice input = gen.Generate(Options().block_size);
661 std::string compressed;
662 bool ok = port::Snappy_Compress(input.data(), input.size(), &compressed);
663 int64_t bytes = 0;
664 char* uncompressed = new char[input.size()];
665 while (ok && bytes < 1024 * 1048576) { // Compress 1G
666 ok = port::Snappy_Uncompress(compressed.data(), compressed.size(),
667 uncompressed);
668 bytes += input.size();
669 thread->stats.FinishedSingleOp();
670 }
671 delete[] uncompressed;
672
673 if (!ok) {
674 thread->stats.AddMessage("(snappy failure)");
675 } else {
676 thread->stats.AddBytes(bytes);
677 }
678 }
679
680 void Open() {
681 assert(db_ == nullptr);

Callers

nothing calls this directly

Calls 9

Snappy_CompressFunction · 0.85
Snappy_UncompressFunction · 0.85
AddMessageMethod · 0.80
AddBytesMethod · 0.80
OptionsClass · 0.50
GenerateMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
FinishedSingleOpMethod · 0.45

Tested by

no test coverage detected