summaryrefslogtreecommitdiff
path: root/sources/scala/tools/util/ReporterTimer.java
blob: 77e91d290ddd9daf2b591aac8c1aa92721242996 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*     ____ ____  ____ ____  ______                                     *\
**    / __// __ \/ __// __ \/ ____/    SOcos COmpiles Scala             **
**  __\_ \/ /_/ / /__/ /_/ /\_ \       (c) 2002, LAMP/EPFL              **
** /_____/\____/\___/\____/____/                                        **
\*                                                                      */

// $Id$

package scala.tools.util;

/**
 * This class implements a timer that uses a Reporter to issue
 * timings.
 */
public class ReporterTimer extends AbstractTimer {

    //########################################################################
    // Private Fields

    /** A reporter to report timing information */
    private final Reporter reporter;

    //########################################################################
    // Public Constructors

    public ReporterTimer(Reporter reporter) {
        this.reporter = reporter;
    }

    //########################################################################
    // Public Methods

    /** Issues a timing information (duration in milliseconds). */
    public void issue(String message, long duration) {
        reporter.inform("[" + message + " in " + duration + "ms]");
    }

    //########################################################################
}