aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Ridgers <[email protected]>2024-11-26 09:39:29 +0100
committerGitHub Enterprise <[email protected]>2024-11-26 09:39:29 +0100
commit8cc15b79d1da03fc1b295eca3e932f7a0b3ec48d (patch)
tree4e96f33f63c7635b0ede3b116554387c2335fbc4
parentDashboard: display package data sizes in oplog entry and tree views. (#232) (diff)
downloadzen-8cc15b79d1da03fc1b295eca3e932f7a0b3ec48d.tar.xz
zen-8cc15b79d1da03fc1b295eca3e932f7a0b3ec48d.zip
Flush CPU scope trace buffers when scope depth reaches zero (#235)
-rw-r--r--thirdparty/trace/trace.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/thirdparty/trace/trace.h b/thirdparty/trace/trace.h
index 612173ce1..28fe6a66e 100644
--- a/thirdparty/trace/trace.h
+++ b/thirdparty/trace/trace.h
@@ -5879,6 +5879,7 @@ private:
uint64 PrevTimestamp = 0;
uint8* Cursor = Buffer;
uint32 ThreadIdOverride = 0;
+ uint16 Depth = 0;
uint8 Buffer[BufferSize];
};
@@ -5890,7 +5891,7 @@ void ScopeBuffer::Flush(bool Force)
if (Cursor == Buffer)
return;
- if (!Force && (Cursor <= (Buffer + BufferSize - Overflow)))
+ if (Depth > 0 && !Force && (Cursor <= (Buffer + BufferSize - Overflow)))
return;
if (ThreadIdOverride)
@@ -5911,6 +5912,7 @@ void ScopeBuffer::Enter(uint64 Timestamp, uint32 ScopeId, int32 Flags)
PrevTimestamp += Timestamp;
Cursor += encode64_7bit((Timestamp) << 1 | EnterLsb, Cursor);
Cursor += encode32_7bit(ScopeId, Cursor);
+ Depth++;
bool ShouldFlush = (Flags & CpuScopeFlags::CpuFlush);
Flush(ShouldFlush);
@@ -5922,6 +5924,7 @@ void ScopeBuffer::Leave(uint64 Timestamp)
Timestamp -= PrevTimestamp;
PrevTimestamp += Timestamp;
Cursor += encode64_7bit((Timestamp << 1) | LeaveLsb, Cursor);
+ Depth--;
Flush(false);
}