Correct mistaken ms to ns conversion change.

PiperOrigin-RevId: 312526413
Change-Id: If9a16f26caf69e1f2c5f434114630dbfacd0c038
This commit is contained in:
Alex Stark 2020-05-20 11:57:59 -07:00 committed by TensorFlower Gardener
parent 26a92af90f
commit bf1afb4a36

View File

@ -57,19 +57,19 @@ public abstract class OvicBenchmarker {
/** Total runtime in ns. */ /** Total runtime in ns. */
protected double totalRuntimeNano = 0.0; protected double totalRuntimeNano = 0.0;
/** Total allowed runtime in ms. */ /** Total allowed runtime in ms. */
protected double wallTimeNano = 20000 * 30 * 1.0e6; protected double wallTimeMilli = 20000 * 30.0;
/** Record whether benchmark has started (used to skip the first image). */ /** Record whether benchmark has started (used to skip the first image). */
protected boolean benchmarkStarted = false; protected boolean benchmarkStarted = false;
/** /**
* Initializes an {@link OvicBenchmarker} * Initializes an {@link OvicBenchmarker}
* *
* @param wallTimeNano: a double number specifying the total amount of time to benchmark. * @param wallTimeMilli: a double number specifying the total amount of time to benchmark.
*/ */
public OvicBenchmarker(double wallTimeNano) { protected OvicBenchmarker(double wallTimeMilli) {
benchmarkStarted = false; benchmarkStarted = false;
totalRuntimeNano = 0.0; totalRuntimeNano = 0.0;
this.wallTimeNano = wallTimeNano; this.wallTimeMilli = wallTimeMilli;
} }
/** Return the cumulative latency of all runs so far. */ /** Return the cumulative latency of all runs so far. */
@ -79,13 +79,13 @@ public abstract class OvicBenchmarker {
/** Check whether the benchmarker should stop. */ /** Check whether the benchmarker should stop. */
public Boolean shouldStop() { public Boolean shouldStop() {
if (totalRuntimeNano >= wallTimeNano) { if ((totalRuntimeNano * 1.0 / 1e6) >= wallTimeMilli) {
Log.e( Log.e(
TAG, TAG,
"Total runtime (ms) " "Total runtime "
+ (totalRuntimeNano * 1.0e-6) + (totalRuntimeNano * 1.0 / 1e6)
+ " exceeded wall-time " + " exceeded walltime (ms) "
+ (wallTimeNano * 1.0e-6)); + wallTimeMilli);
return true; return true;
} }
return false; return false;