[ Merge of http://go/wvgerrit/137810 ] Bug: 204946540 Test: Metric unit tests Change-Id: I78f839fafd27604a2bb78c04d587c40919c5372d
24 lines
612 B
C++
24 lines
612 B
C++
// Copyright 2017 Google LLC. All Rights Reserved. This file and proprietary
|
|
// source code may only be used and distributed under the Widevine License
|
|
// Agreement.
|
|
#include "timer_metric.h"
|
|
|
|
namespace wvcdm {
|
|
namespace metrics {
|
|
void TimerMetric::Start() {
|
|
start_ = clock_.now();
|
|
is_started_ = true;
|
|
}
|
|
|
|
void TimerMetric::Clear() { is_started_ = false; }
|
|
|
|
double TimerMetric::AsMs() const {
|
|
return (clock_.now() - start_) / std::chrono::milliseconds(1);
|
|
}
|
|
|
|
double TimerMetric::AsUs() const {
|
|
return (clock_.now() - start_) / std::chrono::microseconds(1);
|
|
}
|
|
} // namespace metrics
|
|
} // namespace wvcdm
|