Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. We are looking for your feedback about Templates! Tell us about your experiences by taking our survey.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Profiling empty scene on device overhead

Discussion in 'Editor & General Support' started by luisgualandi, Jan 21, 2021.

  1. luisgualandi

    luisgualandi

    Joined:
    Oct 17, 2018
    Posts:
    5
    I profiled an empty scene on my Android tablet and noticed ~1,5 ms worth of the 'Other' section.
    How much of this comes from the profiler and development mode?
     

    Attached Files:

  2. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    1,216
    Hi there,
    As you select samples in the main thread, either in the CPU Profiler Module's hierarchy view or in Timeline view, their contribution to the diffet categories is highlighted in he charts. You can use this, as well as the colors of the samples in Timeline view, to bisect what is contributing how much to each of these.
     
  3. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    1,216
    The Profiler overhead contribution to this should be rather small but would be something visible at the end of the frame in timeline view. A common contributer to Others is also log entries and possibly Unity Remote,if you re using that.
     
  4. luisgualandi

    luisgualandi

    Joined:
    Oct 17, 2018
    Posts:
    5
    Occupants of the 'others' section are scattered in the hierarchy, there's dozens of them with small participation each.
    Initializantion.PlayerTimeUpdate, PostLateUpdate.UpdateAllRenderers, PostLateUpdate.PlayerSendFrameStarted are examples.
    I'm wondering if it is Unity overhead or profiling.
    I have an Idle scene in which I want to use as little energy as possible.
    (didnt saw second comment when posting this)

    I don't have log entries and not using remote
     
  5. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    1,216
    I can't tell from just that. It might just be time not entirely encapsulated in more specific profiler markers so it just ends up in Others. I guess you could call that Unity overhead? The profiling overhead that contributes to Others is found under a specific main thread root sample nd not all over the place. Also that screenshot is so compressed, I can't really tell how much time that adds up to.
     
  6. luisgualandi

    luisgualandi

    Joined:
    Oct 17, 2018
    Posts:
    5
    Hi @MartinTilo, thanks for the response, this probably don't have to do with profiler then.
    Sorry, didn't note that the image was so compressed.
    Here is another, this time from a main menu 2d scene. 8 batches, 338 Tris and 676 Verts.
    'Other' taking almost 5ms.
    Is this normal or something that can be reduced?
    Obs: I'm using OnDemandRendering but I tested without it and it doesn't change.

    image863.png
     
    Last edited: Jan 23, 2021
  7. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    1,216
    You could look into those bigger olive colored leaf samples, I can't quite tell their name. That said, you're pretty much not doing anything here, mostly vSync bound (60 FPS is usually the highest you can go in mobile) and your phone's OS might've just decided to lower the CPU clock frequency, given that you're not really asking it to do any heavy lifting. So some of this apparent overhead might just be down to a lower clock frequency. A platform Profiler like ARM's tools or Android Studio could give you the clock frequency if you want to be sure.
     
  8. luisgualandi

    luisgualandi

    Joined:
    Oct 17, 2018
    Posts:
    5
    Ok, probably nothing serious.
    On the other hand I started testing with an Android 10 device and found something interesting:
    CPU dropped literally 90% on the same scene.
    Turns out it has to do with the "Optimize Frame Pacing" setting, which is not available to some old devices.
    By turning OFP off manually on the editor CPU usage goes up again.
    @MartinTilo Is this a real gain of performance or just an effect?

    The downside is that OFP apparently doens't work well with the "OnDemandRendering" feature and an interval greater than 3.
    It lags a bit when you change the interval and floods the console with a warning:
    "Internal: deleting an allocation that is older than its permitted lifetime of 4 frames"
    Indeed I checked the documentation and its mentioning a problem with OpenGL ES:
    https://docs.unity3d.com/ScriptReference/Rendering.OnDemandRendering.html
     
  9. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    1,216
    How are you measuring CPU usage?

    That probably doesn't need OFP to be on, just OnDemandRendering to skip some 4 frames rapidly. I think this threshold should be revised when using ODR. Could you please file a bug report for this?
     
  10. luisgualandi

    luisgualandi

    Joined:
    Oct 17, 2018
    Posts:
    5
    I was using the profiler.
    Setting a high interval gives you this
    I'll send a bug report
     

    Attached Files:

    MartinTilo likes this.
unityunity