Search Unity

Profiler CPU Timeline colors

Discussion in 'Editor & General Support' started by Maeslezo, Feb 13, 2019.

  1. Maeslezo

    Maeslezo

    Joined:
    Jun 16, 2015
    Posts:
    331
    alexeyzakharov likes this.
  2. alexeyzakharov

    alexeyzakharov

    Joined:
    Jul 2, 2014
    Posts:
    507
    Hi!

    The colors in Timeline View of Profiler Window correspond to different subsystems/areas within Unity.
    The color of most important subsystems is the same as in CPU Usage chart legend (light blue - Scripts, light green - Rendering, etc.). Pink color corresponds to a allocations (GC.Alloc on your screenshot).
    Different colors are used for a quicker visual identification of a particular workload. E.g. you don't want to see pink color in a frame at all. Everything within a scripting marker is something you can change in your code.
     
    MartinTilo likes this.
  3. Maeslezo

    Maeslezo

    Joined:
    Jun 16, 2015
    Posts:
    331
    I have done an empty scene with only one script.
    Although the last bar is blue, the previous bar in the stack is olive green. Update.ScriptRunBehaviourUpdate should be blue too, shouldn't it?
    Or only the last bar has a meaningful color? What does olive green mean?
    What do you mean with scripting marker?

    Thank you
    timeline_2.png
     
    Last edited: Feb 13, 2019
  4. alexeyzakharov

    alexeyzakharov

    Joined:
    Jul 2, 2014
    Posts:
    507
    Update.ScriptRunBehaviourUpdate is a marker produced by Unity native code and represents an "update" stage. I guess that is not very informative for you, so we are working on a filter mode when those are not displayed. Consider it as internal marker.

    Colors might interleave - e.g. you have Timeline.Test.Update() method which is in C# code and it might call some Unity API which results in a native call to some subsystem. That call might have different color. On the screenshot a native "main loop" code marked with olive green called a C# code.
    Olive green is a default color - most of native subsystems are marked with it.

    Scripting markers are explicit ones produced by Profiling Scripting API - Profiler.BeginSample, ProfilerMarker. And implicit - produced automatically for C# callbacks, e.g. MonoBehaviour callbacks, type initializers to highlight C# code entry points.
    Basically scripting markers corresponds to your game code - something you can do about to change things (for better :) ).
     
    MartinTilo and Maeslezo like this.