Profiling CPU and GPU time

So as I hinted in the monthly WIP Sc thread I made a detailed profiler for the engine.
It’s called… DetailedProfiler \o/
usage is, for example in your simple init:

stateManager.attach(new DetailedProfilerState());

Here are the features:

Except from the obvious, lines can be expended/collapsed to hide not needed lines.
Green value means that the time of the line is over 30% of the total frame time
Orange value means that the time exceeds 16,66ms (below 60fps)
Red value means that the time exceeds 33,33 ms (below 30fps).
Dimmed colors means that the time is mostly spent in a child action (idk if that’s clear…).


You can click on the “O” at the beginning of each line to select it. The “selected” entry at the top will be the sum of all selected lines.
Here you can see that I selected all entries relative to the SSAO filter so that the “selected” displays the total time spent rendering SSAO.


You can also click on “hide insignificant stat” to hide 0.00 lines that are most probably not the bottleneck of the rendering, and keep the view clear.

If you have some questions shoot them here…
I’d like to dd the possibility to add custom profiling steps so that you can split your update loop in several step for better cpu profiling.

All this is in master

38 Likes

This is amazing … I apparently need to update to the latest master now

Mithrin

Thanks!

absolutely awesome ! Thank you this will help a lot.

Pretty cool! Thanks :smiley:

Wow. Screens like these definitely convince me to try 3.2… just after I finish major code cleaning I’m in the middle of now(

That is extremely helpful.

Can the stats also be written to a file? This might come in handy for offline profiling like after playtests.

mhh could be yes… but the file could grow huge is a small amount of time
here I display average values over 100 frames, and depending where you look in the scene it can vary a lot… idk if writing a file with the stats without the context would be very interesting… but yeah it can technically be done

:smiley:

:sob:

Updated master to latest, can confirm … is awesome.

Mithrin

1 Like

First of all, thank you for the new profiler! :smiley:

But sometimes (not always) it seems there is a bug if the fps goes under 30 fps. The times of CPU and GPU gets negative o.O



I noticed that with AA x 16 and did not dig it yet. Do you have AA enabled by any chance?

nope MSAA is set to 1x :confused: But I noticed this only happens with vsync off and fullscreen enabled.

btw: It would be cool if there is an official way to customize the profiler translation. At the moment it is forced to the left side of the scree the dirty way inside the update loop:

@Override
public void update(float tpf)
{
	Spatial ui = app.getGuiNode().getChild("Stats ui");
	if (ui != null)
	{
		ui.setLocalTranslation(0, app.getCamera().getHeight(), 0);
	}
}

Edit: In windowed mode the problem occurs below 20fps

very nice, this will surely help with finding performance issues

hahah, and that my friend is what happens when you use an int instead of a long… gonna fix this

2 Likes

fixed in master
About the ui change, I’ll look into it… but I don’t want to add in features that are not absolutely necessary…

I realize I’ve put the profiler in com.jme3.post which is a poor choice. At the beginning it was just meant to be a post process profiler… so I may change it in the next commit, so if you guys are using it you’ll have to fix your imports.

Awesome! thank you for the fast fix :slight_smile: Maybe you can add a getter for the ui Node? Because otherwise I have to compare Strings every frame at the guiNode (see my code example) :confused:

yeah a getter is alright, I’ll add this.

1 Like

great thank you! :blush: