package core:prof/spall
⌘K
Ctrl+K
or
/
Overview
Example:
package main
import "base:runtime"
import "core:prof/spall"
import "core:sync"
spall_ctx: spall.Context
@(thread_local) spall_buffer: spall.Buffer
foo :: proc() {
spall.SCOPED_EVENT(&spall_ctx, &spall_buffer, #procedure)
}
main :: proc() {
spall_ctx = spall.context_create("trace_test.spall")
defer spall.context_destroy(&spall_ctx)
buffer_backing := make([]u8, spall.BUFFER_DEFAULT_SIZE)
spall_buffer = spall.buffer_create(buffer_backing, u32(sync.current_thread_id()))
defer spall.buffer_destroy(&spall_ctx, &spall_buffer)
spall.SCOPED_EVENT(&spall_ctx, &spall_buffer, #procedure)
for i := 0; i < 9001; i += 1 {
foo()
}
}
// Automatic profiling of every procedure:
@(instrumentation_enter)
spall_enter :: proc "contextless" (proc_address, call_site_return_address: rawptr, loc: runtime.Source_Code_Location) {
spall._buffer_begin(&spall_ctx, &spall_buffer, "", "", loc)
}
@(instrumentation_exit)
spall_exit :: proc "contextless" (proc_address, call_site_return_address: rawptr, loc: runtime.Source_Code_Location) {
spall._buffer_end(&spall_ctx, &spall_buffer)
}
Index
Constants (3)
Variables (0)
This section is empty.
Procedure Groups (1)
Types
Context ¶
Related Procedures With Parameters
Related Procedures With Returns
- context_create_with_scale
- context_create_with_sleep
- context_create (procedure groups)
End_Event ¶
End_Event :: struct #packed { type: Manual_Event_Type, pid: u32le, tid: u32le, ts: f64le, }
Manual_Event_Type ¶
Manual_Event_Type :: enum u8 { Invalid = 0, Begin = 3, End = 4, Instant = 5, Pad_Skip = 7, }
Pad_Skip ¶
Pad_Skip :: struct #packed { type: Manual_Event_Type, size: u32le, }
Constants
BEGIN_EVENT_MAX ¶
BEGIN_EVENT_MAX :: size_of(Begin_Event) + 255 + 255
BUFFER_DEFAULT_SIZE ¶
BUFFER_DEFAULT_SIZE :: 0x10_0000
MANUAL_MAGIC ¶
MANUAL_MAGIC :: u64le(0x0BADF00D)
Variables
This section is empty.
Procedures
context_destroy ¶
context_destroy :: proc(ctx: ^Context) {…}
tick_now ¶
tick_now :: proc "contextless" () -> (ns: i64) {…}
Procedure Groups
context_create ¶
context_create :: proc{ context_create_with_scale, context_create_with_sleep, }
Source Files
- doc.odin
- spall.odin
- (hidden platform specific files)
Generation Information
Generated with odin version dev-2024-12 (vendor "odin") Windows_amd64 @ 2024-12-06 21:12:12.677416600 +0000 UTC