diff options
| author | Stefan Boberg <[email protected]> | 2025-06-11 15:32:31 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2025-06-11 15:32:31 +0200 |
| commit | 6b882c3d23babd0d5959f8924084b05ea330ace4 (patch) | |
| tree | c5b33ce7b46247424249f03fb7d9e60648c3cdc4 /src | |
| parent | Merge branch 'rpc-analyze' of https://github.ol.epicgames.net/ue-foundation/z... (diff) | |
| download | zen-6b882c3d23babd0d5959f8924084b05ea330ace4.tar.xz zen-6b882c3d23babd0d5959f8924084b05ea330ace4.zip | |
Added recording_id metadata to RPC recordings
This is necessary to enable analysis of multiple recordings in one run
Diffstat (limited to 'src')
| -rw-r--r-- | src/zenutil/cache/rpcrecording.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/zenutil/cache/rpcrecording.cpp b/src/zenutil/cache/rpcrecording.cpp index 0036be004..8ccebdbbc 100644 --- a/src/zenutil/cache/rpcrecording.cpp +++ b/src/zenutil/cache/rpcrecording.cpp @@ -12,6 +12,7 @@ #include <zencore/system.h> #include <zencore/testing.h> #include <zencore/testutils.h> +#include <zencore/uid.h> ZEN_THIRD_PARTY_INCLUDES_START #include <fmt/format.h> @@ -299,7 +300,7 @@ struct RecordedRequestsSegmentWriter RecordedRequestsSegmentWriter(const RecordedRequestsSegmentWriter&) = delete; RecordedRequestsSegmentWriter& operator=(const RecordedRequestsSegmentWriter&) = delete; - void BeginWrite(const std::filesystem::path& BasePath, uint64_t SegmentIndex, uint64_t RequestBaseIndex); + void BeginWrite(const Oid& RecordingId, const std::filesystem::path& BasePath, uint64_t SegmentIndex, uint64_t RequestBaseIndex); void WriteRequest(const RecordedRequestInfo& RequestInfo, const IoBuffer& RequestBuffer); void EndWrite(); @@ -321,6 +322,7 @@ struct RecordedRequestsSegmentWriter inline DateTime GetEndTime() const { return m_EndTime; } private: + Oid m_RecordingId; std::filesystem::path m_BasePath; uint64_t m_SegmentIndex = 0; uint64_t m_RequestBaseIndex = 0; @@ -366,6 +368,7 @@ private: IoBuffer RequestBuffer; }; + Oid m_RecordingId = Oid::NewOid(); std::unique_ptr<std::thread> m_WriterThread; std::atomic_bool m_IsWriterReady{false}; std::atomic_bool m_IsActive{false}; @@ -423,8 +426,12 @@ private: ////////////////////////////////////////////////////////////////////////// void -RecordedRequestsSegmentWriter::BeginWrite(const std::filesystem::path& BasePath, uint64_t SegmentIndex, uint64_t RequestBaseIndex) +RecordedRequestsSegmentWriter::BeginWrite(const Oid& RecordingId, + const std::filesystem::path& BasePath, + uint64_t SegmentIndex, + uint64_t RequestBaseIndex) { + m_RecordingId = RecordingId; m_BasePath = BasePath; m_SegmentIndex = SegmentIndex; m_RequestBaseIndex = RequestBaseIndex; @@ -438,7 +445,7 @@ RecordedRequestsSegmentWriter::EndWrite() m_RequestCount = m_Entries.size(); m_BlockFiles.clear(); - // Emit some metadata alongside the recording + // Emit some metadata alongside the recorded segment try { @@ -446,6 +453,7 @@ RecordedRequestsSegmentWriter::EndWrite() TimeSpan Duration{m_EndTime.GetTicks() - m_StartTime.GetTicks()}; CbObjectWriter Cbo; + Cbo << "recording_id" << m_RecordingId; Cbo << "time_start" << m_StartTime << "time_end" << m_EndTime << "duration" << Duration; Cbo << "segment_index" << m_SegmentIndex; Cbo << "entry_count" << m_RequestCount << "entry_size" << sizeof(RecordedRequest); @@ -812,7 +820,7 @@ RecordedRequestsWriter::EnsureCurrentSegment() const uint64_t SegmentIndex = m_FinishedSegments.size(); m_CurrentWriter = std::make_unique<RecordedRequestsSegmentWriter>(); - m_CurrentWriter->BeginWrite(m_BasePath / MakeSegmentPath(SegmentIndex), SegmentIndex, m_NextSegmentBaseIndex); + m_CurrentWriter->BeginWrite(m_RecordingId, m_BasePath / MakeSegmentPath(SegmentIndex), SegmentIndex, m_NextSegmentBaseIndex); } return *m_CurrentWriter; @@ -841,10 +849,9 @@ RecordedRequestsWriter::WriteRecordingMetadata() TimeSpan Duration{EndTime.GetTicks() - m_StartTime.GetTicks()}; CbObjectWriter Cbo; + Cbo << "recording_id" << m_RecordingId; Cbo << "time_start" << m_StartTime << "time_end" << EndTime << "duration" << Duration << "format_version" << 2; - Cbo.BeginObject("system_info"); - Cbo << "host" << GetMachineName() << "os" << GetOperatingSystemName() << "cpu" << GetCpuName(); Cbo << "segment_count" << m_FinishedSegments.size(); Cbo << "block_size" << RecordedRequestBlockSize; Cbo << "standalone_threshold" << StandaloneFileSizeThreshold; @@ -852,6 +859,8 @@ RecordedRequestsWriter::WriteRecordingMetadata() Cbo << "segment_file_threshold" << LooseFileThreshold; Cbo << "segment_byte_threshold" << SegmentByteThreshold; + Cbo.BeginObject("system_info"); + Cbo << "host" << GetMachineName() << "os" << GetOperatingSystemName() << "cpu" << GetCpuName(); Describe(GetSystemMetrics(), Cbo); Cbo.EndObject(); |