Add StackProf hooks for profile recalculate

This commit is contained in:
2026-01-08 22:16:54 -06:00
parent 498cf06916
commit 0fac4a0397
3 changed files with 7 additions and 1 deletions

View File

@@ -68,3 +68,7 @@ require_relative "cyberarm_engine/game_state"
require_relative "cyberarm_engine/ui/gui_state" require_relative "cyberarm_engine/ui/gui_state"
require_relative "cyberarm_engine/builtin/intro_state" require_relative "cyberarm_engine/builtin/intro_state"
at_exit do
StackProf.results("./_prof.txt") if RUBY_ENGINE != "mruby" && defined?(StackProf)
end

View File

@@ -224,7 +224,7 @@ module CyberarmEngine
update_child_element_visibity(child) update_child_element_visibity(child)
end end
puts "TOOK: #{Gosu.milliseconds - t}ms to recalculate #{self.class}:0x#{object_id.to_s(16)}'s #{@children.count} children" puts "TOOK: #{Gosu.milliseconds - t}ms to recalculate #{self.class}:0x#{object_id.to_s(16)}'s #{@children.count} children" if is_root?
update_background update_background

View File

@@ -66,7 +66,9 @@ module CyberarmEngine
if @pending_recalculate_request if @pending_recalculate_request
Stats.frame.start_timing(:gui_recalculate) Stats.frame.start_timing(:gui_recalculate)
StackProf.start(mode: :wall) if RUBY_ENGINE != "mruby" && defined?(StackProf)
@root_container.recalculate @root_container.recalculate
StackProf.stop if RUBY_ENGINE != "mruby" && defined?(StackProf)
@pending_recalculate_request = false @pending_recalculate_request = false