瀏覽代碼

add basic usage example

Colin Davidson 2 年之前
父節點
當前提交
6f4f2754d6
共有 1 個文件被更改,包括 24 次插入0 次删除
  1. 24 0
      core/prof/spall/doc.odin

+ 24 - 0
core/prof/spall/doc.odin

@@ -0,0 +1,24 @@
+/*
+import "core:prof/spall"
+
+spall_ctx: spall.Context
+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)
+    defer spall.buffer_destroy(&spall_ctx, &spall_buffer)
+
+    for i := 0; i < 9001; i += 1 {
+		foo()
+    }
+}
+*/
+package spall