2016-11-24 04:17:28 -08:00
|
|
|
/*
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#ifndef MODULES_AUDIO_PROCESSING_TEST_PERFORMANCE_TIMER_H_
|
|
|
|
|
#define MODULES_AUDIO_PROCESSING_TEST_PERFORMANCE_TIMER_H_
|
2016-11-24 04:17:28 -08:00
|
|
|
|
2024-08-29 13:00:40 +00:00
|
|
|
#include <optional>
|
2016-11-24 04:17:28 -08:00
|
|
|
#include <vector>
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "system_wrappers/include/clock.h"
|
2016-11-24 04:17:28 -08:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
namespace test {
|
|
|
|
|
|
|
|
|
|
class PerformanceTimer {
|
|
|
|
|
public:
|
|
|
|
|
explicit PerformanceTimer(int num_frames_to_process);
|
|
|
|
|
~PerformanceTimer();
|
|
|
|
|
|
|
|
|
|
void StartTimer();
|
|
|
|
|
void StopTimer();
|
|
|
|
|
|
|
|
|
|
double GetDurationAverage() const;
|
|
|
|
|
double GetDurationStandardDeviation() const;
|
|
|
|
|
|
2017-03-20 03:03:16 -07:00
|
|
|
// These methods are the same as those above, but they ignore the first
|
2021-07-28 20:50:03 +02:00
|
|
|
// `number_of_warmup_samples` measurements.
|
2017-03-20 03:03:16 -07:00
|
|
|
double GetDurationAverage(size_t number_of_warmup_samples) const;
|
|
|
|
|
double GetDurationStandardDeviation(size_t number_of_warmup_samples) const;
|
|
|
|
|
|
2016-11-24 04:17:28 -08:00
|
|
|
private:
|
|
|
|
|
webrtc::Clock* clock_;
|
2024-08-29 13:00:40 +00:00
|
|
|
std::optional<int64_t> start_timestamp_us_;
|
2016-11-24 04:17:28 -08:00
|
|
|
std::vector<int64_t> timestamps_us_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace test
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // MODULES_AUDIO_PROCESSING_TEST_PERFORMANCE_TIMER_H_
|