mirror of
https://github.com/jamessanford/kegs.git
synced 2024-06-08 06:29:29 +00:00
26 lines
535 B
Java
26 lines
535 B
Java
package com.froop.app.kegs;
|
|
|
|
import android.util.Log;
|
|
|
|
class FpsCounter {
|
|
private String mName;
|
|
private String mIdent;
|
|
private long fpsLast = System.currentTimeMillis() + 1000;
|
|
private int fpsCount = 0;
|
|
|
|
FpsCounter(String logName, String ident) {
|
|
mName = logName;
|
|
mIdent = "fps " + ident + " ";
|
|
}
|
|
|
|
public void fps() {
|
|
fpsCount += 1;
|
|
long fpsNow = System.currentTimeMillis();
|
|
if (fpsNow > fpsLast) {
|
|
Log.w(mName, mIdent + fpsCount);
|
|
fpsLast = fpsNow + 1000;
|
|
fpsCount = 0;
|
|
}
|
|
}
|
|
}
|