Beginning to lift the "grime" files to their own pacakge

This commit is contained in:
2024-05-31 11:26:52 -04:00
parent 65386372fc
commit 3998776f4b
27 changed files with 428 additions and 154 deletions

29
code/grime/profiler.odin Normal file
View File

@ -0,0 +1,29 @@
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 ) {
spall._buffer_begin( & Module_Context.ctx, & Module_Context.buffer, name, "", loc )
}
profile_begin :: #force_inline proc "contextless" ( name : string, loc := #caller_location ) {
spall._buffer_begin( & Module_Context.ctx, & Module_Context.buffer, name, "", loc )
}
profile_end :: #force_inline proc "contextless" () {
spall._buffer_end( & Module_Context.ctx, & Module_Context.buffer)
}