aboutsummaryrefslogtreecommitdiff
path: root/core/prof
diff options
context:
space:
mode:
authorColin Davidson <colrdavidson@gmail.com>2025-07-30 14:09:50 -0700
committerColin Davidson <colrdavidson@gmail.com>2025-07-30 14:09:50 -0700
commit3e10684630bd6cd0602124cf3cb574345483eb93 (patch)
tree652c6cfbac0444b9a1a59c62cbd9a1d94905f973 /core/prof
parent7720a32120429514c806d35e8fdf18018b299d92 (diff)
adjust scale with new format, fix segfault for auto-trace
Diffstat (limited to 'core/prof')
-rw-r--r--core/prof/spall/spall.odin6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/prof/spall/spall.odin b/core/prof/spall/spall.odin
index 4d37913e4..16b809359 100644
--- a/core/prof/spall/spall.odin
+++ b/core/prof/spall/spall.odin
@@ -97,7 +97,7 @@ context_create_with_scale :: proc(filename: string, precise_time: bool, timestam
context_create_with_sleep :: proc(filename: string, sleep := 2 * time.Second) -> (ctx: Context, ok: bool) #optional_ok {
freq, freq_ok := time.tsc_frequency(sleep)
- timestamp_scale: f64 = ((1 / f64(freq)) * 1_000_000) if freq_ok else 1
+ timestamp_scale: f64 = ((1 / f64(freq)) * 1_000_000_000) if freq_ok else 1
return context_create_with_scale(filename, freq_ok, timestamp_scale)
}
@@ -125,6 +125,10 @@ buffer_create :: proc(data: []byte, tid: u32 = 0, pid: u32 = 0) -> (buffer: Buff
@(no_instrumentation)
buffer_flush :: proc "contextless" (ctx: ^Context, buffer: ^Buffer) #no_bounds_check /* bounds check would segfault instrumentation */ {
+ if len(buffer.data) == 0 {
+ return
+ }
+
buffer_size := buffer.head - size_of(Manual_Buffer_Header)
hdr := (^Manual_Buffer_Header)(raw_data(buffer.data))
hdr.size = u32le(buffer_size)