private StopWatch(String label) { mLabel = label; lap(""); }
/** * Create a new instance and start it. */ public static StopWatch start(String label) { return new StopWatch(label); }
mDialpadQueryListener = activity; final StopWatch stopWatch = StopWatch.start("Dialpad.onResume"); stopWatch.lap("qloc"); Settings.System.DTMF_TONE_WHEN_DIALING, 1) == 1; stopWatch.lap("dtwd"); stopWatch.lap("hptc"); stopWatch.lap("fdin"); stopWatch.lap("hnt"); stopWatch.lap("bes"); stopWatch.stopAndLog(TAG, 50);
/** * 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()); }