Browse Source

Add Tracy timing options, ProfilerNull

The ProfilerNull.cake module makes it easier to disable profiling
while leaving the instrumentation in.
windows-imgui
Macoy Madson 6 months ago
parent
commit
14a5b96b5f
  1. 19
      src/ProfilerNull.cake
  2. 36
      src/Tracy.cake

19
src/ProfilerNull.cake

@ -0,0 +1,19 @@
;; Stubs out any profiling functions for easy toggling on/off profiling
(defmacro scope-timed (scope-label string &rest body any)
(tokenize-push output (token-splice-rest body tokens))
(return true))
(defmacro time-this-scope (varname symbol &optional name string)
(return true))
(defmacro profiler-mark-frame (&optional name string)
(return true))
(defmacro timing-zone-start (varname symbol name string)
(return true))
(defmacro timing-zone-stop (varname symbol)
(return true))
;; TODO Remove the need to specify this in every module anyways
(defmacro module-use-tracy-build-options ()
(return true))
(var-global unused int 0)

36
src/Tracy.cake

@ -32,6 +32,42 @@
(token-splice-rest body tokens)))
(return true))
;; TODO: Move into Profiler.cake?
(defmacro time-this-scope (varname symbol &optional name string)
(if name
(tokenize-push output (ZoneNamedN (token-splice varname name) 1))
;; Doesn't work. Why not?
(tokenize-push output (ZoneNamed (token-splice varname) 1)))
(return true))
;; This needed to be a generator to output "FrameMark;" with no parens.
(defgenerator profiler-mark-frame (&optional name (arg-index string))
(if (!= -1 name)
(scope
(var define-statement (const ([] CStatementOperation))
(array
(array KeywordNoSpace "FrameMarkNamed" -1)
(array OpenParen null -1)
(array Expression null 1)
(array CloseParen null -1)
(array SmartEndStatement null -1)))
(return (c-statement-out define-statement)))
(scope
(var define-statement (const ([] CStatementOperation))
(array
(array KeywordNoSpace "FrameMark" -1)
(array SmartEndStatement null -1)))
(return (c-statement-out define-statement))))
(return true))
(defmacro timing-zone-start (varname symbol name string)
(tokenize-push output (TracyCZoneN (token-splice varname name) 1))
(return true))
(defmacro timing-zone-stop (varname symbol)
(tokenize-push output (TracyCZoneEnd (token-splice varname)))
(return true))
;;
;; Building
;;

Loading…
Cancel
Save