Ran clang-format on the metrics directory.

[ Merge of http://go/wvgerrit/137809 ]

Bug: 204946540
Test: Metric unit tests
Change-Id: Ibd68db73ea9ee64664d33c2cb8e8bb7c56674c27
This commit is contained in:
Alex Dale
2021-11-03 17:24:34 -07:00
parent 2046fc05fa
commit 21a021e800
16 changed files with 431 additions and 441 deletions

View File

@@ -37,7 +37,7 @@ class BaseCounterMetric {
// Increment will look for an existing instance of the field names and
// add the new value to the existing value. If the instance does not exist,
// this method will create it.
void Increment(const std::string &counter_key, int64_t value);
void Increment(const std::string& counter_key, int64_t value);
private:
friend class CounterMetricTest;
@@ -99,14 +99,13 @@ class CounterMetric : public BaseCounterMetric {
void Increment(int64_t value, F1 field1 = util::Unused(),
F2 field2 = util::Unused(), F3 field3 = util::Unused(),
F4 field4 = util::Unused()) {
std::string key =
attribute_handler_.GetSerializedAttributes(field1, field2,
field3, field4);
std::string key = attribute_handler_.GetSerializedAttributes(
field1, field2, field3, field4);
BaseCounterMetric::Increment(key, value);
}
void ToProto(::google::protobuf::RepeatedPtrField<drm_metrics::CounterMetric>
*counters) const;
void ToProto(::google::protobuf::RepeatedPtrField<drm_metrics::CounterMetric>*
counters) const;
private:
friend class CounterMetricTest;
@@ -120,13 +119,12 @@ class CounterMetric : public BaseCounterMetric {
template <>
inline void CounterMetric<0, util::Unused, 0, util::Unused, 0, util::Unused, 0,
util::Unused>::
ToProto(::google::protobuf::RepeatedPtrField<drm_metrics::CounterMetric>
*counters) const {
ToProto(::google::protobuf::RepeatedPtrField<drm_metrics::CounterMetric>*
counters) const {
const std::map<std::string, int64_t>* values = GetValues();
for (std::map<std::string, int64_t>::const_iterator it = values->begin();
it != values->end(); it++) {
drm_metrics::CounterMetric *new_counter = counters->Add();
drm_metrics::CounterMetric* new_counter = counters->Add();
new_counter->set_count(it->second);
}
}
@@ -134,12 +132,12 @@ inline void CounterMetric<0, util::Unused, 0, util::Unused, 0, util::Unused, 0,
template <int I1, typename F1, int I2, typename F2, int I3, typename F3, int I4,
typename F4>
inline void CounterMetric<I1, F1, I2, F2, I3, F3, I4, F4>::ToProto(
::google::protobuf::RepeatedPtrField<drm_metrics::CounterMetric>
*counters) const {
::google::protobuf::RepeatedPtrField<drm_metrics::CounterMetric>* counters)
const {
const std::map<std::string, int64_t>* values = GetValues();
for (std::map<std::string, int64_t>::const_iterator it = values->begin();
it != values->end(); it++) {
drm_metrics::CounterMetric *new_counter = counters->Add();
drm_metrics::CounterMetric* new_counter = counters->Add();
if (!new_counter->mutable_attributes()->ParseFromString(it->first)) {
LOGE("Failed to parse the attributes from a string.");
}