Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. The 2022.2 beta is now available for testing. To find out what's new, have a look at our 2022.2 feature highlights.
    Dismiss Notice
  3. We are updating our Terms of Service for all Unity subscription plans, effective October 13, 2022, to create a more streamlined, user-friendly set of terms. Please review them here: unity.com/legal/terms-of-service.
    Dismiss Notice
  4. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice
Dismiss Notice
Submit bug reports tagged with #Beta2022Win_Unity when you encounter unknown issues while testing the 2022.2 betas for a chance to win a year of Unity Pro. For more information, have a look at our Beta Sweepstakes Announcement.

Official Introducing the Editor Iteration Profiler

Discussion in 'Profiler Previews' started by rarepop99, Jun 9, 2020.

  1. rarepop99

    rarepop99

    Unity Technologies

    Joined:
    Sep 5, 2019
    Posts:
    54
    Hi!

    First I would like to clarify My physical Stopwatch says "33,19 ms" -> ~33 sec and if you meant 33,190 ms :)

    Secondly, EIP uses data provided by the Profiler which does have some overhead. For example if you were to use Deep Profiling, those times would be even higher. There's also overhead from the windows themselves. As recommended in the original post, best results are achieved by closing most of the windows then checking out the data. You can also try exporting in HTML which will show you the % distribution of those timings (more useful to know the % of time it takes relative to everything else rather than the exact timing).

    If you want more accurate timings I would suggest you wrap your code with the StopWatch class and handle those yourself.

    Thirdly, as the Domain Reload takes multiple frames and steps it would be a bit difficult to reflect the real timing of it. What this tool provides is a way to identify frames that would be responsible for the majority of the time.
     
  2. Hannibal_Leo

    Hannibal_Leo

    Joined:
    Nov 5, 2012
    Posts:
    481
    Yes, it was a typo xD

    Talking about recompile time here - so I guess, it is not affected by the "Enter Play Mode Settings".

    So to be clear, the EIP does or does not include scene reloading (including Awakes/OnEnable of GameObjects in the Scene, set to [ExecuteAlways]) ?

    The difference is 15 seconds, so it has to be something quite big ...

    I know that all(?) Constructors of Scripts in the Scene and ScriptableObjects are called, while the old ones are thrown away, generating a lot of garbage and it takes some time for GC to clean it up..
    Maybe that's what is missing here? Or something else?
    That's what happens at domain reload "Backup, unload and recreate C# state", right?
     
  3. rarepop99

    rarepop99

    Unity Technologies

    Joined:
    Sep 5, 2019
    Posts:
    54
    Yes, info such as Awake/OnEnable info should be something EIP collects. This tool is more meant to help you as the user to identify problematic areas in your code which you could do something about. EIP simply uses data provided by the Profiler.

    We also report some timings for domain reload in the Editor Logs, maybe check these out too? I don't think the use case you are describing where you want to see for how long the Editor is non-interactible during a domain reload is supported as you would expect, unfortunately.
     
    Hannibal_Leo likes this.
  4. Bryan-Legend

    Bryan-Legend

    Joined:
    Sep 8, 2012
    Posts:
    76
    I've done a ton of optimization and now the majority of my enter/exit times are used in the backup/load scene code, as shown in the attached screenshot.

    The scene I'm working with has thousands of objects and saves to 56mb of YAML on an SSD with a 32 core CPU.

    1. Can your team spend some time optimizing this part of Unity? It would be of high value to everyone. Perhaps multi-threading it like Factorio talks about at the end of this blog post: Friday Facts #364 - 1.1 stable | Factorio

    2. How much performance is lost by using YAML vs. binary saving?

    3. Is there a way to flag a scene as Binary so that I can used mixed mode and not convert my entire project to binary serialization (which takes a few hours)?


    upload_2021-5-13_13-17-41.png
     
    rarepop99 likes this.
  5. Bryan-Legend

    Bryan-Legend

    Joined:
    Sep 8, 2012
    Posts:
    76
    I was able to use mixed by saving a new copy of the scene. Switching to binary scene did not have much of an effect as shown here.
    upload_2021-5-13_13-31-38.png
     
    rarepop99 likes this.
  6. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,519
    Is this package still maintained? @Rarepops
    On GitHub, last update was around 8 months ago.
     
  7. rarepop99

    rarepop99

    Unity Technologies

    Joined:
    Sep 5, 2019
    Posts:
    54
    Hey! Unfortunately, no updates are planned anytime soon, but we're working on other tools that can help users in similar fashion.

    Also, it's basically just reusing the Profiler data such that you could still get this info, albeit manually.
     
    mariandev likes this.
  8. ARESGOW224

    ARESGOW224

    Joined:
    Oct 27, 2019
    Posts:
    4
    Hello! I made a not so obvious astronomical mistake somewhere during development which ended up causing about a 9 minute load time when exiting play mode. Found the event that is causing the huge chunk of time loss but I'm not sure how to modify the event. Its called "Prefabs.ApplyModificationsToObjects." Any advice would be greatly appreciated! :)
    upload_2021-6-13_20-4-5.png
     

    Attached Files:

  9. rarepop99

    rarepop99

    Unity Technologies

    Joined:
    Sep 5, 2019
    Posts:
    54
    Is it something consistent you're seeing?
     
  10. rarepop99

    rarepop99

    Unity Technologies

    Joined:
    Sep 5, 2019
    Posts:
    54
  11. ARESGOW224

    ARESGOW224

    Joined:
    Oct 27, 2019
    Posts:
    4
    Yes. Every time it takes about 9 minutes. What do you think could be affecting that event?
     
  12. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    5,904
    Seems like you either have some very complicated prefab hierarchies, or there's something very bad in the prefab code.
     
  13. ARESGOW224

    ARESGOW224

    Joined:
    Oct 27, 2019
    Posts:
    4
    What would specifically make a prefab complicated? Amount of individual assets? Number of components? Because I do have moving platforms with a dozen or so additional assets attatched. Or perhaps the static flags? I just noticed almost all my static objects are flagged for every static selection. Occluder static, lightmap static, batch static etc...
     
    Last edited: Jun 14, 2021
  14. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    5,904
    I don't know, but I assume prefab variants with a lot of overrides?

    Definitely sounds like you ought to send a bug report with the project attached, sounds like there's room for improvements that can help everyone.
     
    rarepop99 likes this.
  15. AlienFreak

    AlienFreak

    Joined:
    Jul 2, 2012
    Posts:
    39
    Can someone update this to work with Unity 2021? Nothing prints in the window except errors, the JSON export can't be read by Chrome Tracing and the HTML is the only functional way of getting at the profile data but it's pretty painful to use.
     
  16. rarepop99

    rarepop99

    Unity Technologies

    Joined:
    Sep 5, 2019
    Posts:
    54
    Thanks for letting us know! I will take a look at it if time permits (pretty starved for bandwidth lately), right now it isn't maintained and hasn't been for over a year. The plan is to eventually have some better tool to replace this anyway.

    If you feel adventurous, you could attempt fixing the issues, I will review and accept Pull Requests :)
     
    Last edited: Aug 31, 2021
  17. ZenTeapot

    ZenTeapot

    Joined:
    Oct 19, 2014
    Posts:
    48
    unity 2020.3.16f
    after a simple code change, with deep profile on, the profier seems unable to report assembly reload related stats, with this error in the console

    ArgumentException: Could not find thread named 'Domain unloader'
    UnityEditor.EditorIterationProfiler.UnityProfiling.GetFrame (System.Int32 frameIndex, System.String threadName) (at Library/PackageCache/com.unity.editoriterationprofiler@e05c43da15/Editor/UnityProfiling.cs:86)
    UnityEditor.EditorIterationProfiler.ProfilerDataCollector.ReadProfilingData (UnityEditor.EditorIterationProfiler.IterationEventRoot iterationEventRoot, UnityEditor.EditorIterationProfiler.EventData parentEventData, UnityEditor.Profiling.HierarchyFrameDataView frameData, System.Int32 sampleId, UnityEditor.EditorIterationProfiler.EventDataFlags flags, System.Boolean parentHasSingleChild) (at Library/PackageCache/com.unity.editoriterationprofiler@e05c43da15/Editor/ProfilerDataCollector.cs:278)
    UnityEditor.EditorIterationProfiler.ProfilerDataCollector.ReadProfilingData (UnityEditor.EditorIterationProfiler.IterationEventRoot iterationEventRoot, UnityEditor.EditorIterationProfiler.EventData parentEventData, UnityEditor.Profiling.HierarchyFrameDataView frameData, System.Int32 sampleId, UnityEditor.EditorIterationProfiler.EventDataFlags flags, System.Boolean parentHasSingleChild) (at Library/PackageCache/com.unity.editoriterationprofiler@e05c43da15/Editor/ProfilerDataCollector.cs:298)
    UnityEditor.EditorIterationProfiler.ProfilerDataCollector.ReadProfilingData (UnityEditor.EditorIterationProfiler.IterationEventRoot iterationEventRoot, UnityEditor.EditorIterationProfiler.EventData parentEventData, UnityEditor.Profiling.HierarchyFrameDataView frameData, System.Int32 sampleId, UnityEditor.EditorIterationProfiler.EventDataFlags flags, System.Boolean parentHasSingleChild) (at Library/PackageCache/com.unity.editoriterationprofiler@e05c43da15/Editor/ProfilerDataCollector.cs:298)
    UnityEditor.EditorIterationProfiler.ProfilerDataCollector.ReadProfilingData (UnityEditor.EditorIterationProfiler.IterationEventRoot iterationEventRoot, UnityEditor.EditorIterationProfiler.EventData parentEventData, UnityEditor.Profiling.HierarchyFrameDataView frameData, System.Int32 sampleId, UnityEditor.EditorIterationProfiler.EventDataFlags flags, System.Boolean parentHasSingleChild) (at Library/PackageCache/com.unity.editoriterationprofiler@e05c43da15/Editor/ProfilerDataCollector.cs:298)
    UnityEditor.EditorIterationProfiler.ProfilerDataCollector.ReadProfilingData (UnityEditor.EditorIterationProfiler.IterationEventRoot iterationEventRoot, UnityEditor.EditorIterationProfiler.EventData parentEventData, UnityEditor.Profiling.HierarchyFrameDataView frameData, System.Int32 sampleId, UnityEditor.EditorIterationProfiler.EventDataFlags flags, System.Boolean parentHasSingleChild) (at Library/PackageCache/com.unity.editoriterationprofiler@e05c43da15/Editor/ProfilerDataCollector.cs:298)
    UnityEditor.EditorIterationProfiler.ProfilerDataCollector.ReadProfilingData (UnityEditor.EditorIterationProfiler.IterationEventRoot iterationEventRoot, UnityEditor.EditorIterationProfiler.EventData parentEventData, UnityEditor.Profiling.HierarchyFrameDataView frameData, System.Int32 sampleId, UnityEditor.EditorIterationProfiler.EventDataFlags flags, System.Boolean parentHasSingleChild) (at Library/PackageCache/com.unity.editoriterationprofiler@e05c43da15/Editor/ProfilerDataCollector.cs:298)
    UnityEditor.EditorIterationProfiler.ProfilerDataCollector.ReadProfilingData (UnityEditor.EditorIterationProfiler.IterationEventRoot iterationEventRoot, UnityEditor.EditorIterationProfiler.EventData parentEventData, UnityEditor.Profiling.HierarchyFrameDataView frameData, System.Int32 sampleId, UnityEditor.EditorIterationProfiler.EventDataFlags flags, System.Boolean parentHasSingleChild) (at Library/PackageCache/com.unity.editoriterationprofiler@e05c43da15/Editor/ProfilerDataCollector.cs:298)
    UnityEditor.EditorIterationProfiler.ProfilerDataCollector.ReadProfilingData (UnityEditor.EditorIterationProfiler.IterationEventRoot iterationEventRoot, UnityEditor.EditorIterationProfiler.EventData parentEventData, UnityEditor.Profiling.HierarchyFrameDataView frameData, System.Int32 sampleId, UnityEditor.EditorIterationProfiler.EventDataFlags flags, System.Boolean parentHasSingleChild) (at Library/PackageCache/com.unity.editoriterationprofiler@e05c43da15/Editor/ProfilerDataCollector.cs:298)
    UnityEditor.EditorIterationProfiler.ProfilerDataCollector.ReadProfilingData (UnityEditor.EditorIterationProfiler.IterationEventRoot iterationEventRoot, UnityEditor.EditorIterationProfiler.EventData parentEventData, UnityEditor.Profiling.HierarchyFrameDataView frameData, System.Int32 sampleId, UnityEditor.EditorIterationProfiler.EventDataFlags flags, System.Boolean parentHasSingleChild) (at Library/PackageCache/com.unity.editoriterationprofiler@e05c43da15/Editor/ProfilerDataCollector.cs:298)
    UnityEditor.EditorIterationProfiler.ProfilerDataCollector.ReadProfilingData (UnityEditor.EditorIterationProfiler.IterationEventRoot iterationEventRoot, UnityEditor.EditorIterationProfiler.EventData parentEventData, UnityEditor.Profiling.HierarchyFrameDataView frameData, System.Int32 sampleId, UnityEditor.EditorIterationProfiler.EventDataFlags flags, System.Boolean parentHasSingleChild) (at Library/PackageCache/com.unity.editoriterationprofiler@e05c43da15/Editor/ProfilerDataCollector.cs:298)
    UnityEditor.EditorIterationProfiler.ProfilerDataCollector.ProfilerNewFrame (System.Int32 connectionId, System.Int32 newFrameIndex) (at Library/PackageCache/com.unity.editoriterationprofiler@e05c43da15/Editor/ProfilerDataCollector.cs:220)
    UnityEditorInternal.ProfilerDriver.InvokeNewProfilerFrameRecorded (System.Int32 connectionId, System.Int32 newFrameIndex) (at /Users/bokken/buildslave/unity/build/Modules/ProfilerEditor/Public/ProfilerAPI.bindings.cs:308)
     
  18. ZenTeapot

    ZenTeapot

    Joined:
    Oct 19, 2014
    Posts:
    48
    Changing "unloader" to "Unloader" appears to fix the issue.
     
    rarepop99 likes this.
  19. rarepop99

    rarepop99

    Unity Technologies

    Joined:
    Sep 5, 2019
    Posts:
    54
    stonstad and mariandev like this.
  20. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    5,904
    I tried using this recently to figure out why entering play mode through the test runner seems to take forever sometimes. Turns out the test runner completely breaks the tool.

    Starting and ending a play mode test doesn't cause the iteration profiler to show anything. The next time we enter play mode normally, however, the iteration profiler suddenly gets one entry for every play mode test we started previously, but all of them are showing a time of 0.

    Any chance of bugs like that getting fixed since the tool's apparently not really supported anymore? What's the status of the "thing that will eventually replace this"?
     
  21. rarepop99

    rarepop99

    Unity Technologies

    Joined:
    Sep 5, 2019
    Posts:
    54
    Yeah, unfortunately it's not being supported at all... your best option is to use the Profiler and or try to mimic the functionality yourself (or fix the Markers, probably the lookups are broken).

    From the Profiler team's focuses, for the moment the Memory Profiler is their focus for the near-future it seems, so nothing to replace this tool yet. Maybe try com.unity.performance.profile-analyzer?
     
    MartinTilo likes this.
  22. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    375
    This tool, or one similar to it, needs to be a first class citizen within Unity.

    The editor iteration performance issue is very impactful and this tool is currently the easiest way to drill down through the hierarchical timing data. I can't imagine any thing more important.
     
    Alic and SugoiDev like this.
  23. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    1,855
    We agree with you that iteration time and tooling around it is very important for the day to day work within Unity. We'd love to provide better tooling around it and actually integrate it into the normal profiling workflow. Because we don't want to fracture the Tools space more than it already is, and because we think the things needed for this carry a broader benefit for everything else in terms of profiling: Allowing infinite captures and saving of frames bigger than 2GB and bookmarking Iteration Time events and loading all that into the Profile Analyzer were things we considered in our planning. It was a tough choice but, this time around, getting Memory Profiler to 1.0 won over these points.

    That said, other teams are looking at this issue very intently and there are now diagnostic switches to help analyze Iteration Times.

    That said we'll reevaluate priorities after Memory Profiler reaches 1.0 (targeted ETA around 2022.2 beta) and take your comment and the iteration times situation into that consideration. For your context: It'll be up there next to (among others) taking Memory Profiler beyond 1.0 and platform wide GPU profiling support.
     
    stonstad and mariandev like this.
  24. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    5,904
    Honestly, if you really want a lot of bang for very little buck, being able to limit captures to frames over a certain threshold of time or gc would help tremendously.

    The main reason why the editor iteration profiler is useful is that it's able to automatically filter out the frames that take very long, so you don't have to sit ready to hit the "stop recording" button once long frame has finished.

    A filter that allows us to just drop frames that are shorter than X would essentially give us the exact same data as the editor iteration profiler, for a lot less work, and it'd be generally useful otherwise.
     
  25. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    1,855
    That is a fair point and something we considered at the time.
    One key issue that remains in the workflow with that is that you are then stuck with taking screenshots of that data to report bugs to us, as more often than not, these frames would be the ones bigger than 2 GB so you wouldn't be able to save that data out and also not then load it to compare it at a later date.

    Ideally I'd also like us to have a proper setup for automatically bookmarking such frames in a slight more sophisticated way than that and that we build this in a forward facing way towards that vision, instead of as a one off fix that would possibly convolute the follow on step down the line, but it should just require a bit more care and focus on that future while implementing such an intermediate step.

    That said, it could be something that slots in as a small intermediate step between the other broad strokes I mentioned above, as we assess this during planning. In an ideal world we (as in the Profiler Team) would be able to focus on a few key product aspects at a time to address the workflows more holistically, but I accept that that does not necessarily meet the existing and urgent needs in the right way, or properly reflect the practical reality for that matter.
     
    mariandev likes this.
  26. AnsisMalinsUbisoft

    AnsisMalinsUbisoft

    Joined:
    Oct 4, 2019
    Posts:
    8
    When Editor Iteration Profiler is installed from OpenUPM, the editor complains that
    Unity logs this error every time I alt-tab to it, which is extra annoying.
     
    TigerHix likes this.
  27. rarepop99

    rarepop99

    Unity Technologies

    Joined:
    Sep 5, 2019
    Posts:
    54
    Hm, I was sure this was fixed at some point
     
  28. Atrixx

    Atrixx

    Joined:
    Feb 8, 2012
    Posts:
    23
    Last edited: Mar 9, 2022
  29. rarepop99

    rarepop99

    Unity Technologies

    Joined:
    Sep 5, 2019
    Posts:
    54
  30. Zapan15

    Zapan15

    Joined:
    Apr 11, 2011
    Posts:
    156
    Is there a way to make this built in for the editor?
     
  31. rarepop99

    rarepop99

    Unity Technologies

    Joined:
    Sep 5, 2019
    Posts:
    54
    What do you mean, built in? What are you looking to accomplish?
     
  32. Zapan15

    Zapan15

    Joined:
    Apr 11, 2011
    Posts:
    156
    I would like to have the profiler built in into the unity editor, without the need of adding the stuff from github.
    I guess that this could be really handy for a lot of users. :)
    I came across this post by searching the web.
     
    TigerHix and Gooren like this.
  33. Elapotp

    Elapotp

    Joined:
    May 14, 2014
    Posts:
    83
unityunity