Deep profiling player failing

Hi,

after noticing you added deep profiling to the players I immediately had to try it :wink:
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):


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 :slight_smile:

Regards,
Chris

1 Like

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 :slight_smile:

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.

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.

Hi,

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

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 :wink:

Regards,
Chris

Would you consider stripping the project of it’s larger assets to bring it down to a more manageable size? We have a tool for that:

It would help a lot!

1 Like

I didn’t know there is an actual tool to help doing that, so cool!

Do you think it would helpful if the How To Report Bugs page has a “Project too big?” point as well and provides a link to the tool? This issue pops up quite frequently.

Definitely! Thanks for the input :slight_smile:

1 Like

Yeah, I’ll try this, can take a day though :wink:

2 Likes

Did you have a chance to set up a repro yet?

Sorry, haven’t gotten around to this yet but I still have it on my table and won’t forget about it :slight_smile:
Even updated to b9 yesterday as I know you guys like reports with the latest builds :wink:

Thanks a lot!

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.

That sounds great. Really appreciate the work that’s done on the profiler btw :slight_smile:
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 :wink:

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.

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.

Sounds good, will test as soon as it’s public :slight_smile:

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 11px image instead of the original 2k2k 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 :wink: ).

2 Likes

Just had a really short look at b10, seems at least better but will have a closer look tomorrow. :slight_smile:

1 Like

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.

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:

Non matching Profiler.EndSample (BeginSample and EndSample count must match): Profiler.EndSample()

In the player’s log this shows thousands of times:

Can not send network message. Receiver can not keep up with the amount of data sent
1 Like