- Home /
Use Deep Profile to Profile Functions?
Is it possible to use Deep Profile to determine the time to execute specific functions in Profiler? When I try Deep Profile in Profiler I get a profile for my Update functions, but within that I only get times for "StackTraceUtility.PostProcessStacktrace()" and not for the functions contained in Update.
Comment out your debug. Debug logging can be disproportionately expenseive at times.
Thanks. That actually fixes my problem and removes my immediate need to profile specific functions though it be good to find out if that's possible.
Just wanted to add that this fixed my issue as well. Debug.drawline gets expensive very fast during grid pathfinding. Navigating a small 20x20 grid took 600ms a call because of all the logging.
Answer by Statement · Mar 23, 2012 at 03:20 PM
You can provide bits of code with a specific label if you have access to the source code. This allow you to get more control about what is displayed in the profiler.
Profiler.BeginSample ("MyPieceOfCode");
// do something that takes a lot of time
Profiler.EndSample ();
broken link, here is fresh: https://docs.unity3d.com/ScriptReference/Profiling.Profiler.BeginSample.html
By the way, I couldn't get it to work like the docs are saying. Even with "using UnityEngine", I had to call UnityEngine.Profiling.Profiler to be able to invoke it
Your answer
![](https://koobas.hobune.stream/wayback/20220613065425im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Documentation for Profiler functions? 1 Answer
Unity profiler Gfx.WaitForPresentOnGfxThread 2 Answers
Andriod (Oculus Quest 2 app) locked at 30 fps 1 Answer
How do I call a function containing a while loop, inside the update function? 2 Answers
Changing the color of a block when a player walks on it? 2 Answers