private StopWatch(String label) { mLabel = label; lap(""); }
/** * Stop it and log the result, if the total time >= {@code timeThresholdToLog}. */ public void stopAndLog(String TAG, int timeThresholdToLog) { lap(""); final long start = mTimes.get(0); final long stop = mTimes.get(mTimes.size() - 1); final long total = stop - start; if (total < timeThresholdToLog) return; final StringBuilder sb = new StringBuilder(); sb.append(mLabel); sb.append(","); sb.append(total); sb.append(": "); long last = start; for (int i = 1; i < mTimes.size(); i++) { final long current = mTimes.get(i); sb.append(mLapLabels.get(i)); sb.append(","); sb.append((current - last)); sb.append(" "); last = current; } Log.v(TAG, sb.toString()); }