Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Unified Diff: webrtc/modules/audio_coding/neteq/statistics_calculator.h

Issue 1289753008: DRAFT: Make new base class PeriodicUmaLogger (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@neteq-metrics3
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/neteq/statistics_calculator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_coding/neteq/statistics_calculator.h
diff --git a/webrtc/modules/audio_coding/neteq/statistics_calculator.h b/webrtc/modules/audio_coding/neteq/statistics_calculator.h
index bd14530f0e3aa813a59f2e6c9a55cf8bcb83e38b..6280c4e20e93001ea12ec43e1cf2ed07ff94b4fb 100644
--- a/webrtc/modules/audio_coding/neteq/statistics_calculator.h
+++ b/webrtc/modules/audio_coding/neteq/statistics_calculator.h
@@ -11,6 +11,7 @@
#ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_STATISTICS_CALCULATOR_H_
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_STATISTICS_CALCULATOR_H_
+#include <string>
#include <vector>
#include "webrtc/base/constructormagic.h"
@@ -96,39 +97,58 @@ class StatisticsCalculator {
static const int kMaxReportPeriod = 60; // Seconds before auto-reset.
static const int kLenWaitingTimes = 100;
- class DelayedPacketOutagesPerMinuteCounter {
+ class PeriodicUmaLogger {
public:
+ PeriodicUmaLogger(const std::string& uma_name,
+ int report_interval_ms,
+ int max_value);
+ virtual ~PeriodicUmaLogger();
+ void AdvanceClock(int step_ms);
+
+ protected:
+ void LogToUma(int value) const;
+ virtual int Metric() const = 0;
+ virtual void Reset() = 0;
+
+ const std::string uma_name_;
+ const int report_interval_ms_;
+ const int max_value_;
+ int timer_ = 0;
+ };
+
+ class DelayedPacketOutagesPerMinuteCounter final : public PeriodicUmaLogger {
+ public:
+ DelayedPacketOutagesPerMinuteCounter();
~DelayedPacketOutagesPerMinuteCounter() {
- LogToUma(); // Log the count for the current (incomplete) interval.
+ // Log the count for the current (incomplete) interval.
+ LogToUma(Metric());
}
void RegisterEvent();
- void AdvanceClock(int step_ms);
- private:
- static const int kReportIntervalMs = 60 * 1000; // One minute.
-
- void LogToUma() const;
+ protected:
+ int Metric() const override;
+ void Reset() override;
+ private:
int counter_ = 0;
- int timer_ = 0;
};
- class AverageExcessBufferDelayMs {
+ class AverageExcessBufferDelayMs final : public PeriodicUmaLogger {
public:
+ AverageExcessBufferDelayMs();
~AverageExcessBufferDelayMs() {
- LogToUma(); // Log the average for the current (incomplete) interval.
+ // Log the average for the current (incomplete) interval.
+ LogToUma(Metric());
}
void RegisterPacketWaitingTime(int time_ms);
- void AdvanceClock(int step_ms);
- private:
- static const int kReportIntervalMs = 60 * 1000; // One minute.
-
- void LogToUma();
+ protected:
+ int Metric() const override;
+ void Reset() override;
+ private:
double sum_ = 0.0;
int num_packets_ = 0;
- int timer_ = 0;
};
// Calculates numerator / denominator, and returns the value in Q14.
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/neteq/statistics_calculator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698