aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/timer/Timer.h
blob: 446eb254fd10637a5da944d546cb866309020b57 (plain)
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
/*
 * Copyright 2011 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
#ifndef Timer_DEFINED
#define Timer_DEFINED

#include "SkString.h"
#include "SkTime.h"
#include "SkTypes.h"

class WallTimer {
public:
    WallTimer() : fWall(-1) {}

    void start() { fWall = SkTime::GetNSecs(); }
    void end()   { fWall = (SkTime::GetNSecs() - fWall) * 1e-6; }

    double fWall;  // Milliseconds.
};

SkString HumanizeMs(double);

#endif