Files
android/libwvdrmengine/cdm/metrics/include/timer_metric.h
Adam Stone 09c45c4440 Creates a new license request latency metric
Previously, we did not have a license request latency metric. This is a
notable limitation in our metrics. This adds a metric that captures the
timing between a GenerateKeyRequest and an AddKey operation.

Bug: 72994956
Test: New unit tests. Google Play
Change-Id: If99c187399c02f9b5d4c355732af7588bbbefb11
2018-03-30 21:43:48 +00:00

35 lines
786 B
C++

#ifndef WVCDM_METRICS_TIMER_METRIC_H_
#define WVCDM_METRICS_TIMER_METRIC_H_
#include <stdint.h>
namespace wvcdm {
namespace metrics {
class TimerMetric {
public:
// Starts the clock running. If the clock was previously set, this resets it.
// IsStarted will return true after this call.
void Start();
// Returns whether or not the timer has started.
bool IsStarted() const { return is_started_; };
// Stops the clock and clears the current value. IsStarted will return false
// after this call.
void Clear();
// Returns the current clock value as milliseconds (AsMs) or microseconds
// (AsUs).
double AsMs() const;
double AsUs() const;
private:
double sec_;
double usec_;
bool is_started_;
};
} // namespace metrics
} // namespace wvcdm
#endif