aboutsummaryrefslogtreecommitdiff
path: root/src/zen/trace/trace_cache.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/zen/trace/trace_cache.h')
-rw-r--r--src/zen/trace/trace_cache.h31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/zen/trace/trace_cache.h b/src/zen/trace/trace_cache.h
index 88778a020..6b5bd1da9 100644
--- a/src/zen/trace/trace_cache.h
+++ b/src/zen/trace/trace_cache.h
@@ -24,7 +24,7 @@ namespace zen::trace_detail {
// ---------------------------------------------------------------------------
static constexpr uint32_t kCacheMagic = 0x005A4355; // "UCZ\0"
-static constexpr uint32_t kCacheVersion = 1;
+static constexpr uint32_t kCacheVersion = 2; // bump on any layout change
enum class CacheSectionId : uint32_t
{
@@ -33,6 +33,7 @@ enum class CacheSectionId : uint32_t
Memory = 2,
Callstacks = 3,
Symbols = 4,
+ Counters = 5,
Count
};
@@ -211,6 +212,31 @@ struct SymbolEntryPod
uint32_t Pad;
};
+struct CounterDefPod
+{
+ uint16_t Id;
+ uint8_t Type;
+ uint8_t DisplayHint;
+ uint32_t Name; // string index
+};
+
+struct CounterHeaderPod
+{
+ uint16_t Id;
+ uint8_t Type;
+ uint8_t Pad0;
+ uint32_t SampleCount;
+ double Min;
+ double Max;
+};
+
+struct CounterSamplePod
+{
+ uint32_t TimeUs;
+ uint32_t Pad;
+ double Value;
+};
+
// Pin the on-disk layout. Any change here is a cache format change and must
// bump kCacheVersion.
static_assert(sizeof(CacheFileHeader) == 32);
@@ -229,6 +255,9 @@ static_assert(sizeof(CallstackChurnStatPod) == 48);
static_assert(sizeof(CallstackHeaderPod) == 16);
static_assert(sizeof(ResolvedFramePod) == 24);
static_assert(sizeof(SymbolEntryPod) == 16);
+static_assert(sizeof(CounterDefPod) == 8);
+static_assert(sizeof(CounterHeaderPod) == 24);
+static_assert(sizeof(CounterSamplePod) == 16);
// ---------------------------------------------------------------------------
// Cache read / write API