Dump the total time, total number of starts and stops, and average run time of the timer to an output stream. @param out output stream to write info to.
(PrintStream out)
| 53 | * @param out output stream to write info to. |
| 54 | */ |
| 55 | public void print(PrintStream out) |
| 56 | { |
| 57 | if (mStarts == 0) { |
| 58 | out.println(mName + " never started."); |
| 59 | return; |
| 60 | } |
| 61 | |
| 62 | if (mState == State.RUNNING) out.print("WARNING: timer still running! "); |
| 63 | out.print(mName + ": "); |
| 64 | double t = mNanosecs / 1000000000.0; |
| 65 | out.print(t); |
| 66 | out.print(". Run "); |
| 67 | out.print(mStarts); |
| 68 | out.print(" times, average run time "); |
| 69 | long avg = mNanosecs / mStarts; |
| 70 | t = avg / 1000000000.0; |
| 71 | out.print(t); |
| 72 | out.println("."); |
| 73 | } |
| 74 | |
| 75 | /** |
| 76 | * @param name Name of this timer. |
no outgoing calls