godot: Profiler missing most of my functions.
Godot version: 3.2.2
OS/device including version: Windows 10 Version 1903 Build 18362.900
Issue description:
The profiler fails to detect a large portion of my functions and shows a suspiciously low Script Function time.
Using Measure: Frame Time (sec) and Time: Inclusive.
Here’s a screenshot of the profiler on one of the spikes I’m investigating:

It states that the frame takes 34ms in Idle time, but the Script Function total is only 0.19ms!
Further more, the time for Script Function seemingly drops when the load spike occurs. (Pink: Idle, Yellow: Script)

The spike occurs at the start of a turn in my game. It’s spread out since each enemy character’s turn takes at least one frame, ends its turn and then moves on to next until its the players turn. All of this is triggered by signals and some use of yield(get_tree(), "idle_frame")
I’ve checked and doubled checked, by using OS.get_ticks_usec() and Engine.get_idle_frames(), that one of the missing functions actually runs during these frames and is a time hog, but it won’t show up in the profiler (and I double checked the neighboring frames too)!
In fact most of the functions that I’d expect to show in the profiler for that frame are missing.
I managed to optimize the function, so I’m convinced its my own code and not any server or file loading that occurs during these frames.
I’ve tried twiddling the Max Functions setting, but no change. Made a grep for func definitions and only got ~750, so it seems hardly an issue with the default setting of 16k, but I’ve tried 32k and 64k to make sure.
The drop in Script Function time as the load increases suggests to me that there’s some silent overflow besides the Max Function setting.
Steps to reproduce: Unfortunately I’ve failed to pinpoint what causes it. Hope this report is informative enough anyway! I’ll make another attempt at reproducing it at a small scale.
Minimal reproduction project:
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 9
- Comments: 22 (14 by maintainers)
Commits related to this issue
- Increase the default `profiler_frame_max_functions` to 512 This should decrease the number of instances in which functions don't appear in the profiler. This partially addresses #40251. — committed to Calinou/godot by Calinou 4 years ago
- Increase the default `profiler_frame_max_functions` to 512 This should decrease the number of instances in which functions don't appear in the profiler. This partially addresses #40251. — committed to HEAVYPOLY/godot by Calinou 4 years ago
- Increase the default `profiler_frame_max_functions` to 512 This should decrease the number of instances in which functions don't appear in the profiler. This partially addresses #40251. — committed to schme/godot by Calinou 4 years ago
- Fix missing time for some script functions in profiler Fixes the issue by adding a mechanism by which the functions that were previously disappearing can be profiled too. This is optional with an edi... — committed to reach-satori/godot-prof-proj by reach-satori a year ago
- Fix missing time for some script functions in profiler Fixes the issue by adding a mechanism by which the functions that were previously disappearing can be profiled too. This is optional with an edi... — committed to reach-satori/godot-prof-proj by reach-satori a year ago
- Fix missing time for some script functions in profiler Fixes the issue by adding a mechanism by which the functions that were previously disappearing can be profiled too. This is optional with an edi... — committed to reach-satori/godot-prof-proj by reach-satori a year ago
- Fix missing time for some script functions in profiler Fixes the issue by adding a mechanism by which the functions that were previously disappearing can be profiled too. This is optional with an edi... — committed to reach-satori/godot-prof-proj by reach-satori a year ago
- Fix missing time for some script functions in profiler Fixes the issue by adding a mechanism by which the functions that were previously disappearing can be profiled too. This is optional with an edi... — committed to reach-satori/godot-prof-proj by reach-satori a year ago
- Fix missing time for some script functions in profiler Fixes the issue by adding a mechanism by which the functions that were previously disappearing can be profiled too. This is optional with an edi... — committed to reach-satori/godot-prof-proj by reach-satori a year ago
- Fix missing time for some script functions in profiler Fixes the issue by adding a mechanism by which the functions that were previously disappearing can be profiled too. This is optional with an edi... — committed to reach-satori/godot-prof-proj by reach-satori a year ago
- Fix missing time for some script functions in profiler Fixes the issue by adding a mechanism by which the functions that were previously disappearing can be profiled too. This is optional with an edi... — committed to reach-satori/godot-prof-proj by reach-satori a year ago
- Fix missing time for some script functions in profiler Fixes the issue by adding a mechanism by which the functions that were previously disappearing can be profiled too. This is optional with an edi... — committed to reach-satori/godot-prof-proj by reach-satori a year ago
- Fix missing time for some script functions in profiler Fixes the issue by adding a mechanism by which the functions that were previously disappearing can be profiled too. This is optional with an edi... — committed to reach-satori/godot-prof-proj by reach-satori a year ago
- Fix missing time for some script functions in profiler Fixes the issue by adding a mechanism by which the functions that were previously disappearing can be profiled too. This is optional with an edi... — committed to reach-satori/godot-prof-proj by reach-satori a year ago
- Fix missing time for some script functions in profiler Fixes the issue by adding a mechanism by which the functions that were previously disappearing can be profiled too. This is optional with an edi... — committed to reach-satori/godot-prof-proj by reach-satori a year ago
- Fix missing time for some script functions in profiler Fixes the issue by adding a mechanism by which the functions that were previously disappearing can be profiled too. This is optional with an edi... — committed to reach-satori/godot-prof-proj by reach-satori a year ago
- Fix missing time for some script functions in profiler Fixes the issue by adding a mechanism by which the functions that were previously disappearing can be profiled too. This is optional with an edi... — committed to reach-satori/godot-prof-proj by reach-satori a year ago
- Fix missing time for some script functions in profiler Fixes the issue by adding a mechanism by which the functions that were previously disappearing can be profiled too. This is optional with an edi... — committed to reach-satori/godot-prof-proj by reach-satori a year ago
- Fix missing time for some script functions in profiler Fixes the issue by adding a mechanism by which the functions that were previously disappearing can be profiled too. This is optional with an edi... — committed to reach-satori/godot-prof-proj by reach-satori a year ago
- Fix missing time for some script functions in profiler Fixes the issue by adding a mechanism by which the functions that were previously disappearing can be profiled too. This is optional with an edi... — committed to reach-satori/godot-prof-proj by reach-satori a year ago
@Zoomulator I had a similar issue - then I noticed that there is an option in editor “Profiler Frame Max Functions” that’s defaulting to 64 - and I had 2000-5000 calls per frame. See if raising that helps your case.
Oh, that’s great… I probably just copy pasted it in
4.0. I think we can safely remove the clamp in4.0(or raise the maximum to something more reasonable like 32768), not sure in3.2since the network layer there is pretty messy, and if the data is too big it might hang or even crash the editor (like for prints, etc).@Calinou Yes it’s the same problem but in a different area it seems. I don’t know if it’s already part of the plan for profiling improvements, but both cases show we need to start adding more details into profiling information (and I’m sure there’s more).
We could have some extra sub-categories to get more details about the main loop, physics and possibly rendering (if some areas can be clearly identified).
Maybe that could be just for debug, or disabled in release by default and based on some project settings.
This isn’t the case as servers (physics, rendering, …) don’t count as script functions: https://github.com/godotengine/godot/issues/23715
Are there any negative side effects to increasing this value? Maybe we should increase its default value.
Do you have a minimal reproduction project you could provide us? It would help pinpoint the part of your scripts that cause the spikes and then figure out if that could be added to the profiling data.