summaryrefslogtreecommitdiffstats
path: root/libs/utils/StopWatch.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/utils/StopWatch.cpp')
-rw-r--r--libs/utils/StopWatch.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/libs/utils/StopWatch.cpp b/libs/utils/StopWatch.cpp
index 68a1c52..b5dda2f 100644
--- a/libs/utils/StopWatch.cpp
+++ b/libs/utils/StopWatch.cpp
@@ -30,10 +30,9 @@ namespace android {
StopWatch::StopWatch(const char *name, int clock, uint32_t flags)
- : mName(name), mClock(clock), mFlags(flags),
- mStartTime(0), mNumLaps(0)
+ : mName(name), mClock(clock), mFlags(flags)
{
- mStartTime = systemTime(mClock);
+ reset();
}
StopWatch::~StopWatch()
@@ -72,6 +71,12 @@ nsecs_t StopWatch::elapsedTime() const
return systemTime(mClock) - mStartTime;
}
+void StopWatch::reset()
+{
+ mNumLaps = 0;
+ mStartTime = systemTime(mClock);
+}
+
/*****************************************************************************/