/* * Copyright (c) 2016 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.
*/
class AggregatedCounter; class Clock; class Samples;
// `StatsCounterObserver` is called periodically when a metric is updated. class StatsCounterObserver { public: virtualvoid OnMetricUpdated(int sample) = 0;
// Reports metrics for elapsed intervals to AggregatedCounter and GetStats.
AggregatedStats ProcessAndGetStats();
// Reports metrics for elapsed intervals to AggregatedCounter and pauses stats // (i.e. empty intervals will be discarded until next sample is added). void ProcessAndPause();
// As above with a minimum pause time. Added samples within this interval will // not resume the stats (i.e. stop the pause). void ProcessAndPauseForDuration(int64_t min_pause_time_ms);
// Reports metrics for elapsed intervals to AggregatedCounter and stops pause. void ProcessAndStopPause();
// Checks if a sample has been added (i.e. Add or Set called). bool HasSample() const;
// AvgCounter: average of samples // // | * * * | * * | ... // | Add(5) Add(1) Add(6) | Add(5) Add(5) | // GetMetric | (5 + 1 + 6) / 3 | (5 + 5) / 2 | // // `include_empty_intervals`: If set, intervals without samples will be included // in the stats. The value for an interval is // determined by GetValueForEmptyInterval(). // class AvgCounter : public StatsCounter { public:
AvgCounter(Clock* clock,
StatsCounterObserver* observer, bool include_empty_intervals);
~AvgCounter() override {}
// RateCounter: units per second // // | * * * | * * | ... // | Add(5) Add(1) Add(6) | Add(5) Add(5) | // |<------ 2 sec ------->| | // GetMetric | (5 + 1 + 6) / 2 | (5 + 5) / 2 | // // `include_empty_intervals`: If set, intervals without samples will be included // in the stats. The value for an interval is // determined by GetValueForEmptyInterval(). // class RateCounter : public StatsCounter { public:
RateCounter(Clock* clock,
StatsCounterObserver* observer, bool include_empty_intervals);
~RateCounter() override {}
// RateAccCounter: units per second (used for counters) // // | * * * | * * | ... // | Set(5) Set(6) Set(8) | Set(11) Set(13) | // |<------ 2 sec ------->| | // GetMetric | (8 - 0) / 2 | (13 - 8) / 2 | // // `include_empty_intervals`: If set, intervals without samples will be included // in the stats. The value for an interval is // determined by GetValueForEmptyInterval(). // class RateAccCounter : public StatsCounter { public:
RateAccCounter(Clock* clock,
StatsCounterObserver* observer, bool include_empty_intervals);
~RateAccCounter() override {}
// Sets the value for previous interval. // To be used if a value other than zero is initially required. void SetLast(int64_t sample, uint32_t stream_id);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.