aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Davidson <colrdavidson@gmail.com>2025-07-28 16:24:29 -0700
committerColin Davidson <colrdavidson@gmail.com>2025-07-28 16:24:29 -0700
commit2dd1e3c8e31f3a6c0d8af2e469d3d738ecfc2a9a (patch)
tree796e7c29f8ff0feb8947b4943778733082d711b5
parent5b020591d8174e06d5d556ee0baccd1e35aaca49 (diff)
fix casts and consts
-rw-r--r--core/prof/spall/spall.odin14
1 files changed, 8 insertions, 6 deletions
diff --git a/core/prof/spall/spall.odin b/core/prof/spall/spall.odin
index 2c6a981ad..5ad3bf5b8 100644
--- a/core/prof/spall/spall.odin
+++ b/core/prof/spall/spall.odin
@@ -57,6 +57,7 @@ Name_Container_Event :: struct #packed {
type: Manual_Event_Type,
name_len: u8,
}
+NAME_EVENT_MAX :: size_of(Name_Container_Event) + 255
// User Interface
@@ -71,6 +72,7 @@ Buffer :: struct {
head: int,
tid: u32,
pid: u32,
+ first_ts: u64,
}
BUFFER_DEFAULT_SIZE :: 0x10_0000
@@ -125,10 +127,10 @@ buffer_create :: proc(data: []byte, tid: u32 = 0, pid: u32 = 0) -> (buffer: Buff
buffer_flush :: proc "contextless" (ctx: ^Context, buffer: ^Buffer) #no_bounds_check /* bounds check would segfault instrumentation */ {
buffer_size := buffer.head - size_of(Manual_Buffer_Header)
hdr := (^Manual_Buffer_Header)(raw_data(buffer.data))
- hdr.size = buffer_size
- hdr.pid = buffer.pid
- hdr.tid = buffer.tid
- hdr.first_ts = buffer.first_ts
+ hdr.size = u32le(buffer_size)
+ hdr.pid = u32le(buffer.pid)
+ hdr.tid = u32le(buffer.tid)
+ hdr.first_ts = u64le(buffer.first_ts)
start := _trace_now(ctx)
write(ctx.fd, buffer.data[:buffer.head])
@@ -170,12 +172,12 @@ _trace_now :: proc "contextless" (ctx: ^Context) -> u64 {
@(no_instrumentation)
_build_stream_header :: proc "contextless" (buffer: []u8, timestamp_scale: f64) -> (header_size: int, ok: bool) #optional_ok {
- header_size = size_of(Manual_Header)
+ header_size = size_of(Manual_Stream_Header)
if header_size > len(buffer) {
return 0, false
}
- hdr := (^Manual_Header)(raw_data(buffer))
+ hdr := (^Manual_Stream_Header)(raw_data(buffer))
hdr.magic = MANUAL_MAGIC
hdr.version = 3
hdr.timestamp_scale = f64le(timestamp_scale)