Home | History | Annotate | Download | only in timer
      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 
     14 class WallTimer {
     15 public:
     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 
     24 SkString HumanizeMs(double);
     25 
     26 #endif
     27