Merge from http://go/wvgerrit/105767 To avoid conflict with metrics.proto in frameworks/av/drm/libmediadrm/proto. This is in preparation of moving metrics_dump tool to build under Android. bug: 161783052 Test: unit test Test: Play Movies & Tv and Netflix streaming Change-Id: I2406b66db4d61cca7c6260ea8847a555d96c8d42
26 lines
646 B
C++
26 lines
646 B
C++
// Copyright 2017 Google Inc. All Rights Reserved.
|
|
//
|
|
// This file contains implementations for the BaseCounterMetric, the base class
|
|
// for CounterMetric.
|
|
|
|
#include "counter_metric.h"
|
|
|
|
#include "wv_metrics.pb.h"
|
|
|
|
namespace wvcdm {
|
|
namespace metrics {
|
|
|
|
void BaseCounterMetric::Increment(const std::string &counter_key,
|
|
int64_t value) {
|
|
std::unique_lock<std::mutex> lock(internal_lock_);
|
|
|
|
if (value_map_.find(counter_key) == value_map_.end()) {
|
|
value_map_[counter_key] = value;
|
|
} else {
|
|
value_map_[counter_key] = value_map_[counter_key] + value;
|
|
}
|
|
}
|
|
|
|
} // namespace metrics
|
|
} // namespace wvcdm
|