You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
737 B
25 lines
737 B
;; This might not be strictly necessary because auto-instrument imports Tracy for us. For now I'll
|
|
;; keep it until I figure out a better way to have instrument handle profiler selection
|
|
(import "Tracy.cake")
|
|
|
|
(c-import "<stdio.h>")
|
|
|
|
;; TODO: Linux only. For sleep()
|
|
(c-import "unistd.h")
|
|
|
|
(defun-local hot-loop-body ()
|
|
(sleep 1))
|
|
|
|
(defun main (&return int)
|
|
(fprintf stderr "Waiting for profiler to connect...\n")
|
|
(while (not (call-on IsConnected (call (in tracy GetProfiler))))
|
|
(time-this-scope wait-for-profiler "wait for profiler")
|
|
(sleep 1))
|
|
|
|
(var i int 0)
|
|
(var num-times (const int) 10)
|
|
(while (< i num-times)
|
|
(fprintf stderr "hot loop %d / %d\n" i num-times)
|
|
(hot-loop-body)
|
|
(incr i))
|
|
(return 0))
|
|
|