Android Open Source - abstract-art F P S Counter






From Project

Back to project page abstract-art.

License

The source code is released under:

GNU General Public License

If you think the Android project abstract-art listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package net.georgewhiteside.android.abstractart;
//from w w w .j  av a2s  .  c  om
import android.util.Log;
import android.os.SystemClock;

public class FPSCounter {
  private long startTime = 0;
  private long startFrame = 0;
  private long endTime = 0;
  private int frames = 0;
  private long avgFrameTime = 0;
  private int interval = 2000; // output update interval in milliseconds
  
  public void logStartFrame()
  {
    if(startTime == 0)
    {
      startTime = SystemClock.uptimeMillis();
    }
    
    startFrame = SystemClock.uptimeMillis();
  }
  
  public void logEndFrame()
  {
    endTime = SystemClock.uptimeMillis();
    
    avgFrameTime += (endTime - startFrame);
    frames++;
    
    if(endTime - startTime >= interval)
    {
      Log.d("FPS", "FPS: " + (float)frames / (endTime - startTime) * 1000);
      Log.d("RenderTime", "Time to render frame: " + ((float)avgFrameTime / frames) + "ms");
      avgFrameTime = 0;
      startTime = 0;
      frames = 0;
    }
  }

}




Java Source Code List

net.georgewhiteside.android.abstractart.AbstractArt.java
net.georgewhiteside.android.abstractart.BattleBackground.java
net.georgewhiteside.android.abstractart.BattleGroup.java
net.georgewhiteside.android.abstractart.Cache.java
net.georgewhiteside.android.abstractart.Distortion.java
net.georgewhiteside.android.abstractart.Enemy.java
net.georgewhiteside.android.abstractart.FPSCounter.java
net.georgewhiteside.android.abstractart.GLOffscreenSurface.java
net.georgewhiteside.android.abstractart.ImageLoader.java
net.georgewhiteside.android.abstractart.Layer.java
net.georgewhiteside.android.abstractart.Renderer.java
net.georgewhiteside.android.abstractart.RomUtil.java
net.georgewhiteside.android.abstractart.ServiceDialog.java
net.georgewhiteside.android.abstractart.Settings.java
net.georgewhiteside.android.abstractart.ShaderFactory.java
net.georgewhiteside.android.abstractart.Translation.java
net.georgewhiteside.android.abstractart.UniformGridView.java
net.georgewhiteside.android.abstractart.Wallpaper.java
net.georgewhiteside.android.abstractart.settings.BackgroundSelector.java
net.georgewhiteside.android.abstractart.settings.ClearCachePreference.java
net.georgewhiteside.android.abstractart.settings.CreateImageCachePreference.java
net.georgewhiteside.android.abstractart.settings.FrameRatePreference.java
net.georgewhiteside.android.abstractart.settings.ThumbnailAdapter.java
net.georgewhiteside.utility.Dimension.java
net.starmen.pkhack.HackModule.java
org.jf.GLWallpaper.GLWallpaperService.java
sheetrock.panda.changelog.ChangeLog.java