2024-05-31 08:26:52 -07:00
|
|
|
package grime
|
|
|
|
|
|
|
|
import "base:runtime"
|
|
|
|
import "core:prof/spall"
|
|
|
|
|
|
|
|
SpallProfiler :: struct {
|
|
|
|
ctx : spall.Context,
|
|
|
|
buffer : spall.Buffer,
|
|
|
|
}
|
|
|
|
|
|
|
|
@(private)
|
|
|
|
Module_Context : ^SpallProfiler
|
|
|
|
|
|
|
|
set_profiler_module_context :: #force_inline proc "contextless" ( ctx : ^SpallProfiler ) {
|
|
|
|
Module_Context = ctx
|
|
|
|
}
|
|
|
|
|
|
|
|
@(deferred_none = profile_end)
|
|
|
|
profile :: #force_inline proc "contextless" ( name : string, loc := #caller_location ) {
|
2024-06-26 03:03:00 -07:00
|
|
|
spall._buffer_begin( & Module_Context.ctx, & Module_Context.buffer, name, "", loc )
|
2024-05-31 08:26:52 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
profile_begin :: #force_inline proc "contextless" ( name : string, loc := #caller_location ) {
|
2024-06-26 03:03:00 -07:00
|
|
|
spall._buffer_begin( & Module_Context.ctx, & Module_Context.buffer, name, "", loc )
|
2024-05-31 08:26:52 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
profile_end :: #force_inline proc "contextless" () {
|
2024-06-26 03:03:00 -07:00
|
|
|
spall._buffer_end( & Module_Context.ctx, & Module_Context.buffer)
|
2024-05-31 08:26:52 -07:00
|
|
|
}
|