Timer.h revision 70084cbc16ee8162649f2601377feb6e49de0217
1/*
2 * Copyright 2011 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7#ifndef Timer_DEFINED
8#define Timer_DEFINED
9
10#include "SkString.h"
11#include "SkTime.h"
12#include "SkTypes.h"
13
14class WallTimer {
15public:
16    WallTimer() : fWall(-1) {}
17
18    void start() { fWall = SkTime::GetNSecs(); }
19    void end()   { fWall = (SkTime::GetNSecs() - fWall) * 1e-6; }
20
21    double fWall;  // Milliseconds.
22};
23
24SkString HumanizeMs(double);
25
26#endif
27