aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2025-06-27 16:37:50 +0200
committerStefan Boberg <[email protected]>2025-06-27 16:37:50 +0200
commita18ca90d574e1344c57ece9fd9055017634a31b2 (patch)
treee8b11c7aa6c8101734f9580043d3174b74a4576a /src
parentadded initial tracking of namespaces, buckets, keys (diff)
downloadzen-a18ca90d574e1344c57ece9fd9055017634a31b2.tar.xz
zen-a18ca90d574e1344c57ece9fd9055017634a31b2.zip
fleshed out a few more tables
Diffstat (limited to 'src')
-rw-r--r--src/zen/cmds/rpcreplay_cmd.cpp79
1 files changed, 72 insertions, 7 deletions
diff --git a/src/zen/cmds/rpcreplay_cmd.cpp b/src/zen/cmds/rpcreplay_cmd.cpp
index 231244450..862e68491 100644
--- a/src/zen/cmds/rpcreplay_cmd.cpp
+++ b/src/zen/cmds/rpcreplay_cmd.cpp
@@ -524,6 +524,35 @@ RpcReplayAnalyzeCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char*
//
// output schema sketch:
+ // sessions
+ //
+ // <session_id>,<session>
+
+ struct Sessions
+ {
+ // NOTE: *NOT* thread safe at this time
+
+ std::unordered_map<Oid, int> Sessions;
+
+ int SessionToId(const Oid& SessionId)
+ {
+ if (const auto It = Sessions.find(SessionId); It == end(Sessions))
+ {
+ return It->second;
+ }
+ else
+ {
+ const int Id = gsl::narrow_cast<int>(Sessions.size());
+
+ Sessions.insert({SessionId, Id});
+
+ return Id;
+ }
+ }
+ };
+
+ Sessions Ss;
+
// namespaces
//
// <namespace_id>,<namespace>
@@ -628,21 +657,55 @@ RpcReplayAnalyzeCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char*
Keys Ks;
- // sessions
- //
- // <session_id>,<session>
-
// rpc_requests - one entry per recorded RPC request
//
- // <rpc_id>,<session_id>,<namespace_id>,<method>,<request_size>,<attachment_count>
+ // <rpc_id>,<session_id>,<namespace_id>,<rpc_size>,<attachment_count>,<request_count>
+
+ struct RpcRequests
+ {
+ int RpcToId(int SessionId, int NamespaceId, uint64_t RpcSize, int AttachmentCount, int RequestCount)
+ {
+ ZEN_UNUSED(SessionId, NamespaceId, RpcSize, AttachmentCount, RequestCount);
+
+ return ++RpcSerial;
+ }
+
+ int RpcSerial = 0;
+ };
+
+ RpcRequests Rs;
// payloads - one entry per package attachment, one entry per unstructured value
//
- // <rpc_id>,<payload_index>,<payload_hash>,<payload_size>
+ // <payload_id>,<rpc_id>,<payload_index>,<payload_hash>,<payload_size>
+
+ struct RpcPayloads
+ {
+ int PayloadToId(int RpcId, int PayloadIndex, const IoHash& PayloadHash, uint32_t PayloadSize)
+ {
+ ZEN_UNUSED(int RpcId, int PayloadIndex, const IoHash& PayloadHash, uint32_t PayloadSize);
+
+ return ++PayloadSerial;
+ }
+
+ uint64_t PayloadSerial = 0;
+ };
// requests
//
- // <request_id>,<rpc_id>,<key_id>,<payload_hash>
+ // <request_id>,<rpc_id>,<key_id>,<payload_id>
+
+ struct RpcCacheRequest
+ {
+ int CacheRequestToId(int RpcId, int KeyId, uint64_t PayloadId)
+ {
+ ZEN_UNUSED(int RpcId, int KeyId, uint64_t PayloadId);
+
+ return ++CacheRequestId;
+ }
+
+ uint64_t CacheRequestId;
+ };
const uint64_t RangeStart = m_Offset;
const uint64_t RangeEnd = m_Limit ? (m_Offset + m_Limit) : EntryCount;
@@ -669,6 +732,8 @@ RpcReplayAnalyzeCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char*
return;
}
+ const int SessionId = Ss.SessionToId(RequestInfo.SessionId);
+
CbPackage RequestPackage;
CbObject Request;