Chromium Code Reviews| 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_ |