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

Unified Diff: webrtc/modules/audio_coding/main/acm2/delayed_logger.h

Issue 1203803004: Adding a new ChangeLogger class to handle UMA logging of bitrates (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 6 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
Index: webrtc/modules/audio_coding/main/acm2/delayed_logger.h
diff --git a/webrtc/modules/audio_coding/main/acm2/delayed_logger.h b/webrtc/modules/audio_coding/main/acm2/delayed_logger.h
new file mode 100644
index 0000000000000000000000000000000000000000..13aa1e9e3d6c08522d6c2826886d4d2772d3e572
--- /dev/null
+++ b/webrtc/modules/audio_coding/main/acm2/delayed_logger.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_DELAYED_LOGGER_H_
+#define WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_DELAYED_LOGGER_H_
+
+#include <string>
+
+#include "webrtc/base/constructormagic.h"
+
+namespace webrtc {
+namespace acm2 {
+
+// This class handles logging of values to histograms. Registering new values
+// and writing to histogram is handled by separate functions.
+class DelayedLogger {
+ public:
+ explicit DelayedLogger(const std::string& histogram_name);
+ ~DelayedLogger();
+
+ // Logs a new value locally in the DelayedLogger object. Nothing is written
+ // to the histogram from this function. The value will be written on the next
+ // call to MaybeLogTargetBitrate.
+ void SetValue(int value);
kwiberg-webrtc 2015/06/25 09:42:44 It isn't clear from this description that a second
+
+ // Writes value to histogram, if SetValue was called since the last invocation
+ // of MaybeLogValue. If not, this function does nothing.
+ void MaybeLogValue();
kwiberg-webrtc 2015/06/25 09:42:44 You don't suppress logging of a value that's ident
+
+ private:
+ int value_;
+ bool log_on_next_call_;
+ const std::string histogram_name_;
+
+ DISALLOW_COPY_AND_ASSIGN(DelayedLogger);
+};
+
+} // namespace acm2
+} // namespace webrtc
+#endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_DELAYED_LOGGER_H_

Powered by Google App Engine
This is Rietveld 408576698