diff options
| author | Martin Ridgers <[email protected]> | 2024-11-26 09:39:29 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2024-11-26 09:39:29 +0100 |
| commit | 8cc15b79d1da03fc1b295eca3e932f7a0b3ec48d (patch) | |
| tree | 4e96f33f63c7635b0ede3b116554387c2335fbc4 | |
| parent | Dashboard: display package data sizes in oplog entry and tree views. (#232) (diff) | |
| download | zen-8cc15b79d1da03fc1b295eca3e932f7a0b3ec48d.tar.xz zen-8cc15b79d1da03fc1b295eca3e932f7a0b3ec48d.zip | |
Flush CPU scope trace buffers when scope depth reaches zero (#235)
| -rw-r--r-- | thirdparty/trace/trace.h | 5 |
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);
}
|