Search Unity

"Unaccounted" in Profiler

Discussion in 'Editor & General Support' started by SteveJ, Aug 11, 2016.

  1. PerunCreative

    PerunCreative

    Joined:
    Nov 2, 2015
    Posts:
    113
    Hi,
    I had also problem with unaccounted. I was getting huge unaccounted spikes when playing AudioClips (load type - streaming). I am working in 5.4.4 on windows10. I tried 5.6.0b5 but the problem still persisted and the profiler was saying "Unaccounted time between: AudioManager.Update and ParticleSystem.EndUpdate".
    My profiler in 5.4.4 looked like this:
    After some digging I have found the solution. The problem was caused by assigning AudioClip to audiosource.clip:

    Code (CSharp):
    1.  
    2. //----Previous version, which caused spikes----
    3. int n = Random.Range(1, sounds.Length);
    4.  
    5. source.clip = sounds[n];
    6. source.PlayOneShot(source.clip);
    7.  
    8. sounds[n] = sounds[0];
    9. sounds[0] = source.clip;
    10.  
    11. //----New version, no spikes----
    12.  int n = Random.Range(1, sounds.Length);
    13.  
    14. AudioClip sound = sounds[n];
    15. source.PlayOneShot(sound);
    16.  
    17. sounds[n] = sounds[0];
    18. sounds[0] = sound;
    19.  

    I hope this will help someone else :)
     
  2. Codemonger

    Codemonger

    Joined:
    Dec 12, 2013
    Posts:
    30
    Thanks Vasica for bringing attention to this issue. I wish for me it was a coding problem. I thought that may be the case with all the updates since 5.4 . But creating a new project out of the box , the editor on my end is creating the issue - there is no code to test. It may be some object leak or GC / cache issue - of course I switched to an iMac from windows 10.
     
  3. tteneder

    tteneder

    Unity Technologies

    Joined:
    Feb 22, 2011
    Posts:
    175
    Just wanted to share my case:

    TLDR: UnityEngine.Profiling is your friend!

    I also had some "Unaccounted whatevers" taking up much time, so I did:
    • Trial and Error by switching off features one at a time to get a feel what part of the app/game is causing it roughly.
    • Wrapped lots of potentially slow parts with Profiler.BeginSampe/EndSample.
    • Actually found the bad guy(s)
    I am calling functions in a custom native library from C# and vice-versa. Seems like Unity is not able to follow this paths in the profiler and labels it as "Unaccounted".
     
  4. heskethgames

    heskethgames

    Joined:
    Jul 2, 2013
    Posts:
    18
    Well for my 'Unaccounted time between: Start of frame and Camera.Render' I have been turning things off and found it was something texture related. But it was very random as to which texture it decided it didn't like so just reimported it back in and seemed to fix it, but then it picks another texture it doesn't like next time going into the play mode and have to reimport that one, but then the first one seems to break so given up. Its all very strange and just feels like a bug in Unity that I dont think we can fix.
     
  5. Greenwire

    Greenwire

    Joined:
    Nov 1, 2014
    Posts:
    1
    I'm getting:

    Unaccounted Time Between: Canvas.RenderOverlays and GUI.Repaint.

    If I disable the canvas while profiling, the spikes are still there, but it changes to:

    Unaccounted Time Between: Camera.Render and GUI.Repaint.
     
  6. nitroy2k

    nitroy2k

    Joined:
    Jun 27, 2013
    Posts:
    7
    I had same problems now with 5.5.2f1 mac OSX Siera..
    I moved camera on canvas to Canvas - Camera Space and it was removed, but for me for some reason,
    Canvas is causing jerking of the platform elements, for example
    my player works perfectly and camera is Late update follow on him, but when Canvas is enabled all elements jerk....
     
  7. alexeyzakharov

    alexeyzakharov

    Joined:
    Jul 2, 2014
    Posts:
    507
    Hi,

    Thanks for the information!

    The functionality between these labels is related to UpdateCanvasRectTransform, UpdateInputManager.

    That's really strange - these functions go side by side and there shouldn't be any unaccounted samples. Might be profiler issue. We'll investigate.

    Also adding a side note to clarify Unnacounted more.
    "Unnacounted" sample was introduced to display the time of something we didn't profile because it didn't have measurable impact. And it was basically the difference between actual Frame Time and sum of all top-level samples. Later on, when it became clearly not the case, we've introduces pseudo-samples that explicitly identify missing labels between top-level activities (such as BehaviourUpdate, Camera.Render, etc.) in a form of "Unaccounted time between: ...". That allows us first of all to detect that a new functionality should have a correspondent label (we detect this during automated tests run) and secondly add a missing labels to the existing functionality as well.
     
  8. Codemonger

    Codemonger

    Joined:
    Dec 12, 2013
    Posts:
    30
    In a new blank project I am getting this and it is causing about 3ms delay minimum, it spikes even with profiling off and the player off (just stats on) . Maybe something is crashing, are there any hints as to what I can do to debug this to get more information as to what is happening with UpdateCanvasRectTransform or UpdateInputManager. Does this have something to do with the iMac v-sync permanently on ?

    My System is as follows:

    macOS Sierra Version 10.12.3
    IMac 27" - late 2012
    Processor 2.9 GHZ Inte I5
    Memory - 32 GB
    Graphics Nvidia GeForce GTX 660M 512 MB

    I have no troubles running 3D games etc.
     
  9. alexeyzakharov

    alexeyzakharov

    Joined:
    Jul 2, 2014
    Posts:
    507
    If you are talking about Editor in the edit mode, then it's editor-only case and we do Asset GarbageCollection periodically after PlayerCleanupCachedData. In fact that shouldn't be displayed in the Profiler unless Profile Editor is enabled.

    Definitely not crashing - crash would terminate the application and popup a bugreporter :)

    I would normally suggest using Instruments on OSX, but I'm pretty sure we don't ship symbols with the Editor, so the only option is to enable Profile Editor and see if there are any traces of Editor-only activity during a frame.

    It's unlikely - vsync has explicit labels around (WaitForTargetFPS and Gfx.WaitForPresent).
     
  10. Codemonger

    Codemonger

    Joined:
    Dec 12, 2013
    Posts:
    30
    I've purchased VMware Fusion - 1 windows 10 pro licenses as well and fired up a fresh VM of windows 10 pro from my Mac. I've unseated Unity and put it in the virtual windows 10 pro. Created a blank project and I am getting over 1000 fps ... the 3ms delay appears to be absent and it runs fast.
     
  11. clayton-curmi

    clayton-curmi

    Joined:
    Mar 7, 2017
    Posts:
    1
    Hey guys, I am getting the same issues when running a new project (with platform switched to Android). I ran the default scene with nothing added to it and I am getting the following profiler readings (see attached file). This also happens when I build on an Android device (and connect the profiler to the device). I noticed that spikes are generated by simply moving the mouse around (or tapping around on the device). I tried this both on 5.5.0f3 and 5.5.2f1 but still the same issue. My specs are;

    OS: macOS Sierra 10.12
    Model Name: MacBook Pro
    Model Identifier: MacBookPro11,4
    Processor Name: Intel Core i7
    Processor Speed: 2.2 GHz
    Number of Processors: 1
    Total Number of Cores: 4
    L2 Cache (per Core): 256 KB
    L3 Cache: 6 MB
    Memory: 16 GB
     

    Attached Files:

    Last edited: Mar 15, 2017
  12. Codemonger

    Codemonger

    Joined:
    Dec 12, 2013
    Posts:
    30
    Personally believe there be an issue with the editor and Mac OSX Sierra - something takes priority away. I am running unity in "Unity" mode in VMWare Fusion. I get no delays at all and the window is running no different than a native OSX App with the exception of being in a windows 10 window. Even running the windows stretched on my Retina display the speed is full speed. This is my current solution and I'm happy with it as VMWare lets me share my documents and desktop etc. and run windows 10 apps in my docking bar seamlessly. If this bug gets fixed I'm going to probably load it back up on the IMAC, but at least I'm back in business :)
     
    clayton-curmi likes this.
  13. Kubold

    Kubold

    Joined:
    May 10, 2012
    Posts:
    359
    I keep running into a 53.9ms thick spike:

    unaccounted time between: sortinggroupmanager.update and director.prepareframe

    Precisely at the end of playing a movie texture on a Plane (Unlit:Texture material). Every movie texture, 100% repro, Unity 5.6.0f3, Windows 10 64 bit. In plain words, when any movie texture clip reaches the end, this spike happens. In Editor and in Build.


    Clipboard01.jpg
     
  14. hexagonius

    hexagonius

    Joined:
    Mar 26, 2013
    Posts:
    98
    Just wanted to throw something in here too:

    I started working on profiling some assets rendered on screen. Just a bunch of assets, nothing unusual. This is what the Profiler window shows me:

    Screen Shot 2017-04-10 at 16.27.22.png

    Two things arose from that:
    - The graph exceeds the height of the window and I cannot get it to fit
    - The graph that cost the most performance is "Unaccounted time between: PlayerEndOfFrame and Graphics.PresentAndSync". Neither "Deep Profile" nor "High Detail" breaks it down to what it is.

    I'm not really asking for what it means in particular, but rather if there's a list I can look these up myself. As an example problem: Further up this post alexeyzakharow said:

    How would I know that? Where do I get Info about what all these things mean and cause them so I can help myself and fix them on my own?

    Oh and how do you rescale the graph so it fits again?
     
  15. GiantGrey

    GiantGrey

    Joined:
    Jul 2, 2012
    Posts:
    268
    having the same issue with MovieTextures. (Unity 5.5.2)
    Huge slow down and spikes: Unaccounted time between: MeshSkinning.Update and Gfx.WaitForPresent

    Removing MovieTextures fixes the issue. -> guess I will have to use a Plugin.

    Here's the bug report case: 897742
     
  16. krisventure

    krisventure

    Joined:
    Mar 24, 2016
    Posts:
    118
    Mine says:
    Unaccounted time between: UpdateSceenIfNeeded and GPUProfiler.EndQueries.
    Using Unity 5.5.3f1 on Mac (El Capitan). Only when profiling Editor, not when profiling android app. It shows up in every frame though, and even when I hit record while the game isn't even running. And whether game is running or not, these huge spikes show up every second or so. 1 to 4 ms spent on this 'Unaccounted time' at every frame AND during the huge spike this 'UpdateSceenIfNeeded' and 'ProfilerWindow.RepaintAllProfilerWindows' take up like 16ms each. Again, these spikes appear even before I enter Play mode, in case I start profiling, but they get more frequent during play mode. The only difference is that 'UpdateSceenIfNeeded' only stalls during Play mode, while recording outside play mode spikes are added by RepaintAllProfilerWindows alone.

    Screen Shot 2017-05-02 at 00.03.38.png

    Screen Shot 2017-05-02 at 00.13.43.png
     
    Last edited: May 1, 2017
  17. zibizz1

    zibizz1

    Joined:
    Oct 11, 2012
    Posts:
    17
    Unaccounted time between: WaitForTargetFPS and Loading.UpdateWebStream
    Unity 5.5.2.p4
     
  18. Mission-Accomplished

    Mission-Accomplished

    Joined:
    Nov 12, 2015
    Posts:
    1
    Hi everyone,

    I'm new to all this profiling but I'm slightly addicted at the moment :).

    I'm using Unity 5.5.2f1 and have noticed I'm getting unaccounted time in the profiler with the message:

    unaccounted time between: NavMeshManager & Anim.update().

    I'm stress testing a game for android at the moment and have 12 objects that have animation when they first start up. They all have the animator on with a kinematic rigidbody and box collider set as a trigger. I'm also quite sure I'm not using a nav mesh at the moment unless the animations link it to the nav mesh manager, i'm new to all this so that could be the case.

    Also this is not related to this post but I've had to ditch the UI canvas system for images and replace it with a plane mobile/vertexlit blended which is placed in front of the camera due to performance issues it seems to handle it better with the Plane 3D object.
     
    Last edited: May 31, 2017
  19. lightmont

    lightmont

    Joined:
    Oct 8, 2016
    Posts:
    13
    Hi. We have the same problem. We're using Unity 5.6.2f1 (running under Windows 10 PRO) and platform switched to android.

    We're getting multiple unaccounted time:

    Unaccounted time between: Canvas.BuildBatch and CanvasRenderer.SyncTransform
    Unaccounted time between: CanvasRenderer.OnTranformChanged and CanvasRenderer.OnTransformChanged
    Unaccounted time between: CanvasRenderer.OnTranformChanged and Physics2D.ColliderTransformChanged
    Unaccounted time between: Physics.UpdateCloth and Physics2D.ColliderTransformChanged
    Unaccounted time between: CanvasRenderer.OnTranformChanged and CanvasRenderer.SyncTransform
    Unaccounted time between: CanvasRenderer.SyncTransform and CanvasRenderer.SyncWorldRect
    Unaccounted time between: CanvasRenderer.SyncClipRect and Canvas.BuildBatch

    They happen only when profiling an Android app, we're not seeing them on editor profiling.
     

    Attached Files:

    Last edited: Jun 26, 2017
  20. Zackton

    Zackton

    Joined:
    Nov 20, 2015
    Posts:
    1

    I have the same problem whereas MovieTextures cause: "Unaccounted time between: SortingGroupManager.Update and Director.PrepareFrame" in the Profiler, but the problem seems to extend past only happening when reaching the end / looping a movie.

    I remove the MovieTexture from the List<> that holds it, as well as Destory()'ing the GameObject that holds it, re-called the method where the GameObject with the MovieTexture is instantiated, and all through this time, "Unaccounted time between: SortingGroupManager.Update and Director.PrepareFrame" existed in the Profiler. Now that I have re-called the method, and it seems the first MovieTexture was never removed, there are now what seems like TWO MovieTextures doing their thing (because the ms amount in the Profiler is even larger after calling the method for the second time), even though only one exists in the scene.

    I am running Win 10 64-bit, on Unity 5.6.1f1, so also a very similar set-up as Kubold. No idea if it is just a Windows thing, I can not test it sorry, but it happens in the Editor as well as in a Build.


    EDIT:
    I have downloaded/installed 2017.1.0f3 and this is now called PostLateUpdate.UpdateVideoTextures. Still quite a large number (80-120ms after two re-calls of the method), still same behaviour. Are we supposed to be unloading MovieTextures manually?

    EDIT #2:
    I have solved my problem by using Resources.UnloadUnusedAssets(); right after I have finished Destory()'ing the last GameObject holding a MovieTexture. Problem Solved.
     
    Last edited: Jul 25, 2017
  21. UDN_8f0a3536-4717-4220-80f7-cdbf4a536312

    UDN_8f0a3536-4717-4220-80f7-cdbf4a536312

    Joined:
    Dec 17, 2016
    Posts:
    2
    Massive impact on Xiaomi RN 4: fps drops to 30-40 because of Unaccounted time between PlayerEndOfFrame and InputProcess. Any suggestions?
     

    Attached Files:

  22. thedrhax14

    thedrhax14

    Joined:
    Aug 7, 2014
    Posts:
    38
    Hi, I have "Unaccounted" problem as well, but slightly different: UnaccountedEditorCompilation Interface.isCompiling() and File.Open. Can someone help to fix? Is it maybe Editor-MonoDevelop problem? It drops frame rate in the editor to 1 or 0.5 frames per second. I also attached the screenshot from profiller. Screen Shot 2017-08-02 at 4.16.15 PM.png
     
    Last edited: Aug 2, 2017
  23. laessnb

    laessnb

    Joined:
    Jun 10, 2014
    Posts:
    101
    Having a big problem with this on both 5.5 and latest 5.6. The beginning unaccounted tag is a variety of things, including UpdateSceneIfNeeded and PlayerCleanupCachedData. The end tag is almost always Usb.OnDeviceChanged(). This causes a massive hiccup of about 2-4 seconds every time it happens. Super frustrating to have the editor go unresponsive for that long due to this. Any further ideas?
     
  24. laessnb

    laessnb

    Joined:
    Jun 10, 2014
    Posts:
    101
    @alexeyzakharov here's an example where it hangs for 5 seconds on 5.6.3f1, submitted bug with case report 944210:

    http://imgur.com/a/uY9VS

    EDIT 8/29/17: Wanted to update this post. I tried creating a brand new project and the problem persisted. At that point, I realized it was likely something with my Win10 environment, so I started killing off background processes. One of those must have been the culprit, because I haven't had the problem occur since then. Most likely it was my webcam driver or something to do with realtime security scanning.
     
    Last edited: Aug 29, 2017
  25. Loius

    Loius

    Joined:
    Aug 16, 2012
    Posts:
    546
    I'm getting a spike of 1,692ms (that's 1.6 seconds!) whenever I switch to the Unity editor from another window (e.g, save code, switch over, wait 1.6s, compile begins)

    The log I'm getting is "Unaccounted time between: [varies] and HostView.OnFocus"
    [Varies] has been HandleUtility.EndHandles and PlayerCleanupCachedData that I've seen so far.

    [Edit] Looks like this one is related to some kind of "did anything change" scan. I threw out a few hundred files we weren't using anymore and it dropped to a consistent 1.5s delay. Project is currently 28k files, 1800 folders, and 10gb in the Assets folder.
     
    Last edited: Dec 22, 2017
  26. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    Bump, I am seeing the same issue. My issue is exactly the same as @Loius
     
  27. Grosnus

    Grosnus

    Joined:
    Mar 4, 2015
    Posts:
    17
    I also have same issue as @Loius. Seems to be related to how big the project is since our is really large and it takes about 5 seconds of lag before I am able to focus on the editor window again. If the pc specs are lower, the spike is even greater.

    Before I upgraded from Unity 2017.1.2p3 to 2017.3 there was no such problem.
     
  28. alexeyzakharov

    alexeyzakharov

    Joined:
    Jul 2, 2014
    Posts:
    507
    Hi guys, thanks for the update.

    I suspect this is related to assets refresh. Do you have "Auto Refresh" off?

    Was is working fine with 2017.1.2p3 and the same Assets folder content?
    Please file a bug if so - this is a regression then.
     
  29. Grosnus

    Grosnus

    Joined:
    Mar 4, 2015
    Posts:
    17
    In 2017.1.2p3 Unity window takes about 0.5s to focus with the same Assets folder, so it's absolutely fine. I will send bug report asap.
     
    alexeyzakharov likes this.
  30. AGregori

    AGregori

    Joined:
    Dec 11, 2014
    Posts:
    527
    I have a similar major issue in 2017.3.0p3: it's not unaccounted, but the symptoms are very similar:

    GUIUtility.Processevent() causes game-breaking spikes in a new project in an idle editor. Any suggestions?
     
  31. hromoyDron

    hromoyDron

    Joined:
    Jan 24, 2013
    Posts:
    90
    Hi!
    Can you say what is unaccounted time?
    Does it only profiler & editor problem?
    Or it's real problem witch slow down my game in final not development build?
     
  32. MrIconic

    MrIconic

    Joined:
    Apr 5, 2013
    Posts:
    239
    Unaccounted time between: GC.Alloc and EditorCompilationInterface.HaveSetupErrors()
    ~1852.25ms

    Every single time I refocus onto the Unity client.

    Edit: Doesn't happen in a new project so an asset might be causing it.


    Had to uninstall and then re-install Unity. (Also upgraded to 2017.3.0p4 from previous version)
     
    Last edited: Feb 1, 2018
  33. Lucas-Hehir

    Lucas-Hehir

    Joined:
    Jul 2, 2014
    Posts:
    41
    Hey guys, I've been getting big freezes that last between 5-10 seconds like this for time immemorial. Going back at least a year, across different versions of Unity, different projects and even different computers. Today, I finally caught an offending frame in the Profiler just like that described above, described as:

    "Unaccounted time between: ApplicationTickTimer and GC.Alloc"

    They generally take upwards of 10000ms, as pictured in the screen shots below. I tried to "Show Related Objects" on this entry but it crashed, prompting a bug report which I'm currently uploading.

    I've attached two screenshots below, one for the frame before and the frame after.
     

    Attached Files:

  34. Lucas-Hehir

    Lucas-Hehir

    Joined:
    Jul 2, 2014
    Posts:
    41