aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/zen/cmds/rpcreplay_cmd.cpp29
-rw-r--r--src/zen/cmds/rpcreplay_cmd.h1
2 files changed, 28 insertions, 2 deletions
diff --git a/src/zen/cmds/rpcreplay_cmd.cpp b/src/zen/cmds/rpcreplay_cmd.cpp
index fbb01a1e5..de3f7f6ac 100644
--- a/src/zen/cmds/rpcreplay_cmd.cpp
+++ b/src/zen/cmds/rpcreplay_cmd.cpp
@@ -494,6 +494,7 @@ RpcAnalyzeCommand::RpcAnalyzeCommand()
m_Options.add_options()("h,help", "Print help");
m_Options.add_option("", "p", "path", "Recording file path", cxxopts::value(m_RecordingPath), "<path>");
m_Options.add_option("", "o", "output", "Report directory path", cxxopts::value(m_ReportPath), "<path>");
+ m_Options.add_option("", "", "clean", "Clean output directory", cxxopts::value(m_Clean), "<bool>");
m_Options.parse_positional("path");
m_Options.parse_positional("output");
@@ -566,6 +567,18 @@ RpcAnalyzeCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv
}
};
+ if (m_Clean)
+ {
+ ZEN_CONSOLE("cleaning '{}'...", TargetPath);
+ std::error_code Ec;
+ CleanDirectory(TargetPath, true, Ec);
+
+ if (Ec)
+ {
+ ZEN_CONSOLE_WARN("clean failed: '{}'", Ec.message());
+ }
+ }
+
GcManager Gc;
std::unique_ptr<JobQueue> Jq = MakeJobQueue(2, "cache_jobs");
Ref<ZenCacheStore> Store(new ZenCacheStore(Gc, *Jq, TargetPath / "cache", Config, nullptr));
@@ -588,6 +601,9 @@ RpcAnalyzeCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv
int MaxBatchSeen = 0;
uint64_t RequestsSeen = 0;
+ uint64_t InsertedChunkCount = 0;
+ uint64_t InsertedDataBytes = 0;
+
for (uint64_t EntryIndex = 0; EntryIndex < EntryCount; ++EntryIndex)
{
IoBuffer Payload;
@@ -645,7 +661,16 @@ RpcAnalyzeCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv
if (!Hashes.empty())
{
- Cids.AddChunks(AttachmentData, Hashes);
+ auto Results = Cids.AddChunks(AttachmentData, Hashes);
+
+ for (int i = 0; i < Results.size(); ++i)
+ {
+ if (Results[i].New)
+ {
+ InsertedChunkCount += 1;
+ InsertedDataBytes += AttachmentData[i].GetSize();
+ }
+ }
}
++RequestsSeen;
@@ -888,7 +913,7 @@ RpcAnalyzeCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv
}
}
- ZEN_CONSOLE("Total Requests: {:12}", RequestsSeen);
+ ZEN_CONSOLE("Total Requests: {:12}, inserted {} bytes in {} chunks", RequestsSeen, InsertedDataBytes, InsertedChunkCount);
}
} // namespace zen
diff --git a/src/zen/cmds/rpcreplay_cmd.h b/src/zen/cmds/rpcreplay_cmd.h
index f9dffa939..09e042980 100644
--- a/src/zen/cmds/rpcreplay_cmd.h
+++ b/src/zen/cmds/rpcreplay_cmd.h
@@ -77,6 +77,7 @@ private:
std::string m_HostName;
std::string m_RecordingPath;
std::string m_ReportPath;
+ bool m_Clean = false;
};
} // namespace zen