diff --git a/tools/trace_analyzer_tool.cc b/tools/trace_analyzer_tool.cc index 7915322f0..e6ec48cd1 100644 --- a/tools/trace_analyzer_tool.cc +++ b/tools/trace_analyzer_tool.cc @@ -276,6 +276,7 @@ TraceAnalyzer::TraceAnalyzer(std::string& trace_path, std::string& output_path, total_access_keys_ = 0; total_gets_ = 0; total_writes_ = 0; + trace_create_time_ = 0; begin_time_ = 0; end_time_ = 0; time_series_start_ = 0; @@ -422,6 +423,7 @@ Status TraceAnalyzer::StartProcessing() { fprintf(stderr, "Cannot read the header\n"); return s; } + trace_create_time_ = header.ts; if (FLAGS_output_time_series) { time_series_start_ = header.ts; } @@ -740,6 +742,9 @@ Status TraceAnalyzer::MakeStatisticCorrelation(TraceStats& stats, // Process the statistics of QPS Status TraceAnalyzer::MakeStatisticQPS() { + if(begin_time_ == 0) { + begin_time_ = trace_create_time_; + } uint32_t duration = static_cast((end_time_ - begin_time_) / 1000000); int ret; diff --git a/tools/trace_analyzer_tool.h b/tools/trace_analyzer_tool.h index ac9f42f1c..b171ef22c 100644 --- a/tools/trace_analyzer_tool.h +++ b/tools/trace_analyzer_tool.h @@ -204,6 +204,7 @@ class TraceAnalyzer { uint64_t total_access_keys_; uint64_t total_gets_; uint64_t total_writes_; + uint64_t trace_create_time_; uint64_t begin_time_; uint64_t end_time_; uint64_t time_series_start_;