2011-07-28 14:26:00 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2011 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
2014-06-20 18:29:20 +00:00
|
|
|
#ifndef Timer_DEFINED
|
|
|
|
#define Timer_DEFINED
|
2011-06-07 19:16:02 +00:00
|
|
|
|
2015-10-23 13:40:33 +00:00
|
|
|
#include "SkString.h"
|
2015-10-23 14:02:06 +00:00
|
|
|
#include "SkTime.h"
|
|
|
|
#include "SkTypes.h"
|
2015-10-23 13:40:33 +00:00
|
|
|
|
2014-06-16 21:04:32 +00:00
|
|
|
class WallTimer {
|
|
|
|
public:
|
2015-10-23 14:02:06 +00:00
|
|
|
WallTimer() : fWall(-1) {}
|
2014-06-16 21:04:32 +00:00
|
|
|
|
2015-10-23 14:02:06 +00:00
|
|
|
void start() { fWall = SkTime::GetNSecs(); }
|
|
|
|
void end() { fWall = (SkTime::GetNSecs() - fWall) * 1e-6; }
|
2014-06-16 21:04:32 +00:00
|
|
|
|
2014-06-20 18:29:20 +00:00
|
|
|
double fWall; // Milliseconds.
|
2014-06-16 21:04:32 +00:00
|
|
|
};
|
|
|
|
|
2015-01-15 18:56:12 +00:00
|
|
|
SkString HumanizeMs(double);
|
2017-09-20 16:53:00 +00:00
|
|
|
int HumanizeMs(char*, int len, double);
|
2015-01-15 18:56:12 +00:00
|
|
|
|
2011-06-07 19:16:02 +00:00
|
|
|
#endif
|