mirror of
https://github.com/sbrow/envr.git
synced 2026-06-27 10:38:33 -04:00
test: Added spall config back.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -11,6 +11,7 @@ man
|
||||
builds
|
||||
envr
|
||||
envr-go
|
||||
envr-prof
|
||||
findr/findr
|
||||
findr/findr-prof
|
||||
findr/bench-*.md
|
||||
|
||||
9
Makefile
9
Makefile
@@ -10,7 +10,7 @@ LINUX_AMD64_BIN := $(BUILD_DIR)/$(APP_NAME)-$(VERSION)-linux-amd64
|
||||
LINUX_ARM64_BIN := $(BUILD_DIR)/$(APP_NAME)-$(VERSION)-linux-arm64
|
||||
DARWIN_ARM64_BIN := $(BUILD_DIR)/$(APP_NAME)-$(VERSION)-darwin-arm64
|
||||
|
||||
.PHONY: all clean cleanall build-linux build-darwin compress release help
|
||||
.PHONY: all clean cleanall build-linux build-darwin compress release profile help
|
||||
|
||||
# Default target
|
||||
all: release clean
|
||||
@@ -66,6 +66,12 @@ release: build-linux compress
|
||||
@echo "Release artifacts created:"
|
||||
@ls -la $(BUILD_DIR)/*.tar.gz $(BUILD_DIR)/*.zip 2>/dev/null || echo "No compressed artifacts found"
|
||||
|
||||
# Build with spall profiling instrumentation
|
||||
profile:
|
||||
@echo "Building with spall profiling..."
|
||||
odin build . -define:SPALL=true -o:speed -out:envr-prof
|
||||
@echo "Built envr-prof (run it to generate envr.spall)"
|
||||
|
||||
# Clean binary files only
|
||||
clean:
|
||||
@echo "Cleaning binary files..."
|
||||
@@ -84,6 +90,7 @@ help:
|
||||
@echo " build-linux - Build Linux binaries only"
|
||||
@echo " build-darwin - Build Darwin binaries only"
|
||||
@echo " compress - Compress all built binaries"
|
||||
@echo " profile - Build with spall profiling instrumentation"
|
||||
@echo " clean - Remove binary files only"
|
||||
@echo " cleanall - Remove entire build directory"
|
||||
@echo " help - Show this help message"
|
||||
|
||||
44
main.odin
44
main.odin
@@ -1,10 +1,36 @@
|
||||
package main
|
||||
|
||||
import "base:runtime"
|
||||
import "core:fmt"
|
||||
import "core:mem"
|
||||
import "core:os"
|
||||
import "core:prof/spall"
|
||||
import "core:sync"
|
||||
|
||||
SPALL :: #config(SPALL, false)
|
||||
when SPALL {
|
||||
spall_ctx: spall.Context
|
||||
@(thread_local)
|
||||
spall_buffer: spall.Buffer
|
||||
}
|
||||
|
||||
main :: proc() {
|
||||
when SPALL {
|
||||
ctx, spall_ok := spall.context_create_with_scale("envr.spall", false, 1.0)
|
||||
if !spall_ok {
|
||||
fmt.eprintln("Failed to create spall trace file")
|
||||
os.exit(1)
|
||||
}
|
||||
spall_ctx = ctx
|
||||
defer spall.context_destroy(&spall_ctx)
|
||||
|
||||
spall_backing := make([]u8, spall.BUFFER_DEFAULT_SIZE)
|
||||
defer delete(spall_backing)
|
||||
|
||||
spall_buffer = spall.buffer_create(spall_backing, u32(sync.current_thread_id()))
|
||||
defer spall.buffer_destroy(&spall_ctx, &spall_buffer)
|
||||
}
|
||||
|
||||
when ODIN_DEBUG {
|
||||
heap_track: mem.Tracking_Allocator
|
||||
mem.tracking_allocator_init(&heap_track, context.allocator)
|
||||
@@ -60,3 +86,21 @@ main :: proc() {
|
||||
}
|
||||
}
|
||||
|
||||
when SPALL {
|
||||
@(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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BIN
test_cond_import
Executable file
BIN
test_cond_import
Executable file
Binary file not shown.
Reference in New Issue
Block a user