io_tracer_parser_tool.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
  2. // This source code is licensed under both the GPLv2 (found in the
  3. // COPYING file in the root directory) and Apache 2.0 License
  4. // (found in the LICENSE.Apache file in the root directory).
  5. #pragma once
  6. #include <memory>
  7. #include "rocksdb/env.h"
  8. #include "rocksdb/status.h"
  9. namespace ROCKSDB_NAMESPACE {
  10. struct IOTraceHeader;
  11. struct IOTraceRecord;
  12. // IOTraceRecordParser class reads the IO trace file (in binary format) and
  13. // dumps the human readable records in output_file_.
  14. class IOTraceRecordParser {
  15. public:
  16. explicit IOTraceRecordParser(const std::string& input_file);
  17. // ReadIOTraceRecords reads the binary trace file records one by one and
  18. // invoke PrintHumanReadableIOTraceRecord to dump the records in output_file_.
  19. int ReadIOTraceRecords();
  20. private:
  21. void PrintHumanReadableHeader(const IOTraceHeader& header);
  22. void PrintHumanReadableIOTraceRecord(const IOTraceRecord& record);
  23. // Binary file that contains IO trace records.
  24. std::string input_file_;
  25. };
  26. int io_tracer_parser(int argc, char** argv);
  27. } // namespace ROCKSDB_NAMESPACE