mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 741281 - Add Telemetry timers in Java. r=blassey
This commit is contained in:
parent
2b00edbc12
commit
b777441ad8
@ -5,9 +5,9 @@
|
||||
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
@ -33,4 +33,23 @@ public class Telemetry {
|
||||
Log.e(LOGTAG, "JSON exception: ", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Timer {
|
||||
private long mStartTime;
|
||||
private String mName;
|
||||
|
||||
public Timer(String name) {
|
||||
mName = name;
|
||||
mStartTime = SystemClock.uptimeMillis();
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
long elapsed = SystemClock.uptimeMillis() - mStartTime;
|
||||
if (elapsed < Integer.MAX_VALUE) {
|
||||
HistogramAdd(mName, (int)(elapsed));
|
||||
} else {
|
||||
Log.e(LOGTAG, "Duration of " + elapsed + " ms is too long.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user