Added an easy way to add sub steps to the profiler (#1067)
* Added an easy way to add sub steps to the profiler and enhanced the App State Manager to profile the update method of each app state * Added the profiler step to the android profiler * Fixed missing profiler extensions
This commit is contained in:
parent
ffa1df2aff
commit
0bc060d474
@ -135,6 +135,11 @@ public class DefaultAndroidProfiler implements AppProfiler {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appSubStep(String... additionalInfo) {
|
||||
|
||||
}
|
||||
|
||||
public void vpStep(VpStep vpStep, ViewPort vp, RenderQueue.Bucket bucket) {
|
||||
if (androidApiLevel >= 18) {
|
||||
switch (vpStep) {
|
||||
|
@ -187,6 +187,10 @@ public class BasicProfiler implements AppProfiler {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appSubStep(String... additionalInfo) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vpStep( VpStep step, ViewPort vp, Bucket bucket ) {
|
||||
}
|
||||
|
@ -88,6 +88,17 @@ public class DetailedProfiler implements AppProfiler {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void appSubStep(String... additionalInfo) {
|
||||
if (data != null) {
|
||||
String pathStep = getPath("", additionalInfo);
|
||||
path.setLength(0);
|
||||
path.append(curAppPath).append(pathStep);
|
||||
addStep(path.toString(), System.nanoTime());
|
||||
}
|
||||
}
|
||||
|
||||
private void closeFrame() {
|
||||
//close frame
|
||||
if (data != null) {
|
||||
|
@ -32,6 +32,7 @@
|
||||
package com.jme3.app.state;
|
||||
|
||||
import com.jme3.app.Application;
|
||||
import com.jme3.profile.AppProfiler;
|
||||
import com.jme3.renderer.RenderManager;
|
||||
import com.jme3.util.SafeArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -300,6 +301,9 @@ public class AppStateManager {
|
||||
AppState[] array = getStates();
|
||||
for (AppState state : array){
|
||||
if (state.isEnabled()) {
|
||||
if (app.getAppProfiler() != null) {
|
||||
app.getAppProfiler().appSubStep(state.getClass().getSimpleName());
|
||||
}
|
||||
state.update(tpf);
|
||||
}
|
||||
}
|
||||
|
@ -51,6 +51,11 @@ public interface AppProfiler {
|
||||
*/
|
||||
public void appStep(AppStep step);
|
||||
|
||||
/**
|
||||
* Called as a substep of the previous AppStep
|
||||
*/
|
||||
public void appSubStep(String... additionalInfo);
|
||||
|
||||
/**
|
||||
* Called at the beginning of the specified VpStep during
|
||||
* the rendering of the specified ViewPort. For bucket-specific
|
||||
|
@ -90,6 +90,11 @@ public class TestShaderNodesStress extends SimpleApplication {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appSubStep(String... additionalInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void vpStep(VpStep step, ViewPort vp, RenderQueue.Bucket bucket) {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user