Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Deep profiling player failing

Discussion in '2017.3 Beta' started by Alloc, Oct 31, 2017.

  1. Alloc

    Alloc

    Joined:
    Jun 5, 2013
    Posts:
    241
    Hi,

    after noticing you added deep profiling to the players I immediately had to try it ;)
    Unfortunately while it does seem to do a deep profiling the data is basically useless. Unity spits out thousands of "Non matching Profiler.EndSample (BeginSample and EndSample count must match): Profiler.EndSample()" messages and if you look at the data for a frame you get inconsistent values, like in this shot where you can easily see that some levels of the hierarchy get values that just don't match the child (just looked at the execution time so far):
    capture_001_31102017_121351.jpg
    Also, you can see that the timeline basically never goes above 10ms. If I select for example the line "GM" in the hierarchy it properly shows all the frames that have a high ex.time in that method (which is a few).

    Hoping this feature can get improved to work properly, this is a really great thing to get :)

    Regards,
    Chris
     
    alexeyzakharov likes this.
  2. Alloc

    Alloc

    Joined:
    Jun 5, 2013
    Posts:
    241
    PS: Seems like deep profiling in the editor itself is also affected by the inconsistent hierarchy results for execution time. Though again I get a lot of those "Non matching Profiler.EndSample (BeginSample and EndSample count must match): Profiler.EndSample()" messages, so might be the same issue.

    And the Begin/EndSample calls (at least those that we manually added to the code) are definitely ok, the same source works just fine in 2017.1 in regards to profiling data :)
     
  3. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,590
    Have you considered submitting a bug-report, following the advice given in this document?!

    Using the bug-reporter seems to be an important step, because it makes sure the report is in Unity Technologies bug-tracking pipeline and has to be processed at some point. Using the forum is often used to add to a little more attention to a bug-report, but does not replace submitting the bug-report.

    It's from advantage to attach a project to the bug-report that UT can use to reproduce the issue and test their fix against. The easier an issue can be reproduced by QA, the more likely it is to get forwarded to a developer, who might or might not work on a bug-fix for that at some point.

    After you submitted the bug-report, you receive a confirmation email with a Case number. UT often asks us to post the Case number in the forum thread, which allows them to find that bug-report if they look at your post.

    Following these steps will increase the chance that UT is looking at your issue tremendously.
     
  4. alexeyzakharov

    alexeyzakharov

    Joined:
    Jul 2, 2014
    Posts:
    507
    Hi!

    Thanks for trying it out!
    From the screenshot I see that there is a self profiling happening - there should be no Profiler.BeginSample/EndSample markers in the hierarchy. That definitely might cause "Non matching.. " error and wrong time accumulation.

    Is it possible to file a bug and attach the project so we can take a look more closely? This situation doesn't happen in our test cases.
     
  5. Alloc

    Alloc

    Joined:
    Jun 5, 2013
    Posts:
    241
    Hi,

    thanks for your replies :)
    As for uploading the project: It's by now way over 10 GB, not really my most liked idea to upload that ;)

    As for the Profiler.BeginSample in the hierarchy: It's always been that way that they show up as an element in the deep profile hierarchy when the code hits a spot that runs Profiler.BeginSample (as we need that when doing non-deep profiles) but it wasn't an issue before. It would just properly attribute the time etc to that BeginSample call in the hierarchy for whatever is in between the Begin/End pair.

    If the new profiler code won't accept having manual Begin/EndSample calls in the code we would have to filter them out depending on whether we're going for a deep or non-deep profiling run each time so that won't work out and should somehow be taken care of by Unity itself in my opinion ;)

    Regards,
    Chris
     
  6. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,132
    Peter77 likes this.
  7. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,590
  8. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,132
    Definitely! Thanks for the input :)
     
    Peter77 likes this.
  9. Alloc

    Alloc

    Joined:
    Jun 5, 2013
    Posts:
    241
    Yeah, I'll try this, can take a day though ;)
     
    alexeyzakharov and LeonhardP like this.
  10. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,132
    Did you have a chance to set up a repro yet?
     
  11. Alloc

    Alloc

    Joined:
    Jun 5, 2013
    Posts:
    241
    Sorry, haven't gotten around to this yet but I still have it on my table and won't forget about it :)
    Even updated to b9 yesterday as I know you guys like reports with the latest builds ;)
     
  12. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,132
    Thanks a lot!
     
  13. alexeyzakharov

    alexeyzakharov

    Joined:
    Jul 2, 2014
    Posts:
    507
    Hi!
    Bug report is very much appreciated!
    Also 2017.3b10 will be containing a fix which potentially addresses the issue - we have fixed an automatic begin/end markers parity check when exception happens. It caused similar picture with unaligned samples.
     
  14. Alloc

    Alloc

    Joined:
    Jun 5, 2013
    Posts:
    241
    That sounds great. Really appreciate the work that's done on the profiler btw :)
    As for the parity check thing: Just to be clear, this is about some internal issues? Parity of those markers in our code is definitely ok, as otherwise it wouldn't have worked in U2017.1 either I suppose ;)

    As for the repro: I'll test in b9 now, if it's still the same I'll give the stripping tool a go. Luckily this already shows up in the main menu so it shouldn't require a lot of assets to get there.
     
  15. alexeyzakharov

    alexeyzakharov

    Joined:
    Jul 2, 2014
    Posts:
    507
    There was an internal behavior change of how we "auto end" markers in case of C# exception. Which might case the picture you have seen with deepprofiler - e.g. if there was an exception thrown and we didn't autoclose intermediate function markers. We fixed that. No changes in the code should be required from your side.
     
  16. Alloc

    Alloc

    Joined:
    Jun 5, 2013
    Posts:
    241
    Sounds good, will test as soon as it's public :)

    Also just submitted a bug report including a stripped down project, don't have the case number yet though. PS: Case number is 969225.

    Btw, for the stripping tool it might be cool if it would actually replace stripped stuff with empty stuff so that code that relies on things does not fail but e.g. load a 1*1px image instead of the original 2k*2k px, or a 1 sample audio file instead of the original one. As it looks the stripping tool does nothing more than delete full assets/folders, nothing that's helping me any more than a regular file explorer or a tool like Scanner (actually that tool's even better as it does not only show the top level size but I can go down as many folders as needed ;) ).
     
    Last edited: Nov 15, 2017
    alexeyzakharov and LeonhardP like this.
  17. Alloc

    Alloc

    Joined:
    Jun 5, 2013
    Posts:
    241
    Just had a really short look at b10, seems at least better but will have a closer look tomorrow. :)
     
    alexeyzakharov likes this.
  18. alexeyzakharov

    alexeyzakharov

    Joined:
    Jul 2, 2014
    Posts:
    507
    I've tested the 969225 project with the latest 2017.3 and didn't find any anomalies with samples. Hopefully, it was the same issue we fixed.
     
  19. Alloc

    Alloc

    Joined:
    Jun 5, 2013
    Posts:
    241
    Submitted another report yesterday (case 976439). While the in-editor profiling seems to be fine so far the deep profiling in the player still fails. Though it seems to be related to the issue that the memory profiler has, i.e. the editor can't keep up with the data coming from the player.
    The editor shows hundreds of these messages:
    Code (csharp):
    1. Non matching Profiler.EndSample (BeginSample and EndSample count must match): Profiler.EndSample()
    In the player's log this shows thousands of times:
    Code (csharp):
    1. Can not send network message. Receiver can not keep up with the amount of data sent
     
    alexeyzakharov likes this.