Debian Codegraph @

net/sf/saxon/trans/Timer.java

raw symbols SCIP
1 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2018 Saxonica Limited.
3 // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4 // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.
6 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7
8 package net.sf.saxon.trans;
9
10 /**
11 * Utility class for collecting and reporting timing information, used only under diagnostic control
12 */
13 public class Timer {
14
15 private long start;
16 private long prev;
17
18 public Timer() {
19 start = System.currentTimeMillis();
20 prev = start;
21 }
22
23 public void report(String label) {
24 long time = System.currentTimeMillis();
25 System.err.println(label + " " + (time - prev) + "ms");
26 prev = time;
27 }
28
29 public void reportCumulative(String label) {
30 long time = System.currentTimeMillis();
31 System.err.println(label + " " + (time - start) + "ms");
32 prev = time;
33 }
34 }