X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=trace_snappyfile.cpp;h=4dbe42dc364264a8db0e717a1af17681b9af271e;hb=c5b741c83e804f1e438caca83565a76e254d0b94;hp=1794a829c6635c2a57a11b33e446958dc908fe54;hpb=487c9d09fa18989b1f93951e17893f10109a97fa;p=apitrace diff --git a/trace_snappyfile.cpp b/trace_snappyfile.cpp index 1794a82..4dbe42d 100644 --- a/trace_snappyfile.cpp +++ b/trace_snappyfile.cpp @@ -93,6 +93,10 @@ bool SnappyFile::rawOpen(const std::string &filename, File::Mode mode) //read in the initial buffer if we're reading if (m_stream.is_open() && mode == File::Read) { + m_stream.seekg(0, std::ios::end); + m_endPos = m_stream.tellg(); + m_stream.seekg(0, std::ios::beg); + // read the snappy file identifier unsigned char byte1, byte2; m_stream >> byte1; @@ -327,3 +331,8 @@ bool SnappyFile::rawSkip(size_t length) return true; } + +int SnappyFile::rawPercentRead() +{ + return 100 * (double(m_stream.tellg()) / double(m_endPos)); +}