public BasicProfilerState( boolean enabled ) { setEnabled(enabled); this.profiler = new BasicProfiler(); }
/** * Sets the number of frames to display and track. By default * this is 1280. */ public final void setFrameCount( int size ) { if( this.size == size ) { return; } this.size = size; this.frames = new long[size*2]; createMesh(); if( frameIndex >= size ) { frameIndex = 0; } }
/** * Sets the number frames displayed and tracked. * @param count the number of frames */ public void setFrameCount( int count ) { if( profiler.getFrameCount() == count ) { return; } profiler.setFrameCount(count); refreshBackground(); }
public int getFrameCount() { return profiler.getFrameCount(); }
public BasicProfiler( int size ) { setFrameCount(size); }
@Override protected void initialize( Application app ) { graph = new Geometry("profiler", profiler.getMesh()); Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md"); mat.setBoolean("VertexColor", true); graph.setMaterial(mat); graph.setLocalTranslation(0, 300, 0); graph.setLocalScale(1, scale, 1); Mesh mesh = new Mesh(); background = new Geometry("profiler.background", mesh); mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md"); mat.setBoolean("VertexColor", true); mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha); background.setMaterial(mat); background.setLocalTranslation(0, 300, -1); background.setLocalScale(1, scale, 1); refreshBackground(); InputManager inputManager = app.getInputManager(); if( inputManager != null ) { inputManager.addMapping(INPUT_MAPPING_PROFILER_TOGGLE, new KeyTrigger(KeyInput.KEY_F6)); inputManager.addListener(keyListener, INPUT_MAPPING_PROFILER_TOGGLE); } }
@Override public void appStep( AppStep step ) { switch(step) { case BeginFrame: startTime = System.nanoTime(); break; case RenderFrame: renderTime = System.nanoTime(); frames[frameIndex * 2] = renderTime - startTime; break; case EndFrame: long time = System.nanoTime(); frames[frameIndex * 2 + 1] = time - renderTime; previousFrame = startTime; frameIndex++; if( frameIndex >= size ) { frameIndex = 0; } if( startTime - lastUpdate > updateInterval ) { updateMesh(); lastUpdate = startTime; } break; } }
protected void refreshBackground() { Mesh mesh = background.getMesh(); int size = profiler.getFrameCount(); float frameTime = 1000f / 60; mesh.setBuffer(Type.Position, 3, new float[] {
public BasicProfiler( int size ) { setFrameCount(size); }
@Override protected void initialize( Application app ) { graph = new Geometry("profiler", profiler.getMesh()); Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md"); mat.setBoolean("VertexColor", true); graph.setMaterial(mat); graph.setLocalTranslation(0, 300, 0); graph.setLocalScale(1, scale, 1); Mesh mesh = new Mesh(); background = new Geometry("profiler.background", mesh); mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md"); mat.setBoolean("VertexColor", true); mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha); background.setMaterial(mat); background.setLocalTranslation(0, 300, -1); background.setLocalScale(1, scale, 1); refreshBackground(); InputManager inputManager = app.getInputManager(); if( inputManager != null ) { inputManager.addMapping(INPUT_MAPPING_PROFILER_TOGGLE, new KeyTrigger(KeyInput.KEY_F6)); inputManager.addListener(keyListener, INPUT_MAPPING_PROFILER_TOGGLE); } }
@Override public void appStep( AppStep step ) { switch(step) { case BeginFrame: startTime = System.nanoTime(); break; case RenderFrame: renderTime = System.nanoTime(); frames[frameIndex * 2] = renderTime - startTime; break; case EndFrame: long time = System.nanoTime(); frames[frameIndex * 2 + 1] = time - renderTime; previousFrame = startTime; frameIndex++; if( frameIndex >= size ) { frameIndex = 0; } if( startTime - lastUpdate > updateInterval ) { updateMesh(); lastUpdate = startTime; } break; } }
/** * Sets the number frames displayed and tracked. * @param count the number of frames */ public void setFrameCount( int count ) { if( profiler.getFrameCount() == count ) { return; } profiler.setFrameCount(count); refreshBackground(); }
public int getFrameCount() { return profiler.getFrameCount(); }
public BasicProfilerState( boolean enabled ) { setEnabled(enabled); this.profiler = new BasicProfiler(); }
/** * Sets the number of frames to display and track. By default * this is 1280. */ public final void setFrameCount( int size ) { if( this.size == size ) { return; } this.size = size; this.frames = new long[size*2]; createMesh(); if( frameIndex >= size ) { frameIndex = 0; } }
protected void refreshBackground() { Mesh mesh = background.getMesh(); int size = profiler.getFrameCount(); float frameTime = 1000f / 60; mesh.setBuffer(Type.Position, 3, new float[] {