StopwatchCollection.start("realize"); NounList sourceData = (NounList)etc.calculateRealization(itsObs[j]); StopwatchCollection.stop("realize");To make a report, create a
PrintStream
and send the report to it:
FileOutputStream fout = new FileOutputStream("stopwatch.txt"); PrintStream ps = new PrintStream(fout); ps.println("stopwatch output for TimingTestWithDatabase"); ps.println("nFilters="+nFilters); ps.println("targetListOriginal.size()="+targetListOriginal.size()); ps.println("sequenceListOriginal.size()="+sequenceListOriginal.size()); StopwatchCollection.report(ps); fout.close();If you "forgot" to stop a stopwatch, an informative warning will go to the
PrintStream
.
You can also make a plot of the number of seconds since a stopwatch was reset (or created) vs. the count of the number of times it was stopped.
StopwatchCollection.plot("Save Supernovae","TimingTestWithDatabaseSupernova");
You have to keep track of the stopwatch names yourself. If you start
a name that does not exist, a new stopwatch will
be created. If you try to do anything else to a stopwatch name that does not exist, you will be ignored silently.