Added more refined benchmarking code for audioproc_f
This CL extends, and partly corrects, the benchmarking code in audioproc_f to provide statistics for the API call durations in audioproc_f Bug: chromium:939791 Change-Id: I4c26c4bb3782335f13dd3e21e6f861842539ea62 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/129260 Commit-Queue: Per Åhgren <peah@webrtc.org> Reviewed-by: Sam Zackrisson <saza@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27443}
This commit is contained in:
@ -20,6 +20,7 @@
|
||||
#include "absl/types/optional.h"
|
||||
#include "common_audio/channel_buffer.h"
|
||||
#include "modules/audio_processing/include/audio_processing.h"
|
||||
#include "modules/audio_processing/test/api_call_statistics.h"
|
||||
#include "modules/audio_processing/test/fake_recording_device.h"
|
||||
#include "modules/audio_processing/test/test_utils.h"
|
||||
#include "rtc_base/constructor_magic.h"
|
||||
@ -85,6 +86,7 @@ struct SimulationSettings {
|
||||
bool simulate_mic_gain = false;
|
||||
absl::optional<int> simulated_mic_kind;
|
||||
bool report_performance = false;
|
||||
absl::optional<std::string> performance_report_output_filename;
|
||||
bool report_bitexactness = false;
|
||||
bool use_verbose_logging = false;
|
||||
bool use_quiet_output = false;
|
||||
@ -101,14 +103,6 @@ struct SimulationSettings {
|
||||
absl::optional<std::string> aec_settings_filename;
|
||||
};
|
||||
|
||||
// Holds a few statistics about a series of TickIntervals.
|
||||
struct TickIntervalStats {
|
||||
TickIntervalStats() : min(std::numeric_limits<int64_t>::max()) {}
|
||||
int64_t sum;
|
||||
int64_t max;
|
||||
int64_t min;
|
||||
};
|
||||
|
||||
// Copies samples present in a ChannelBuffer into an AudioFrame.
|
||||
void CopyToAudioFrame(const ChannelBuffer<float>& src, AudioFrame* dest);
|
||||
|
||||
@ -124,8 +118,10 @@ class AudioProcessingSimulator {
|
||||
// Processes the data in the input.
|
||||
virtual void Process() = 0;
|
||||
|
||||
// Returns the execution time of all AudioProcessing calls.
|
||||
const TickIntervalStats& proc_time() const { return proc_time_; }
|
||||
// Returns the execution times of all AudioProcessing calls.
|
||||
const ApiCallStatistics& GetApiCallStatistics() const {
|
||||
return api_call_statistics_;
|
||||
}
|
||||
|
||||
// Reports whether the processed recording was bitexact.
|
||||
bool OutputWasBitexact() { return bitexact_output_; }
|
||||
@ -136,22 +132,6 @@ class AudioProcessingSimulator {
|
||||
}
|
||||
|
||||
protected:
|
||||
// RAII class for execution time measurement. Updates the provided
|
||||
// TickIntervalStats based on the time between ScopedTimer creation and
|
||||
// leaving the enclosing scope.
|
||||
class ScopedTimer {
|
||||
public:
|
||||
explicit ScopedTimer(TickIntervalStats* proc_time)
|
||||
: proc_time_(proc_time), start_time_(rtc::TimeNanos()) {}
|
||||
|
||||
~ScopedTimer();
|
||||
|
||||
private:
|
||||
TickIntervalStats* const proc_time_;
|
||||
int64_t start_time_;
|
||||
};
|
||||
|
||||
TickIntervalStats* mutable_proc_time() { return &proc_time_; }
|
||||
void ProcessStream(bool fixed_interface);
|
||||
void ProcessReverseStream(bool fixed_interface);
|
||||
void CreateAudioProcessor();
|
||||
@ -194,7 +174,7 @@ class AudioProcessingSimulator {
|
||||
size_t num_reverse_process_stream_calls_ = 0;
|
||||
std::unique_ptr<ChannelBufferWavWriter> buffer_writer_;
|
||||
std::unique_ptr<ChannelBufferWavWriter> reverse_buffer_writer_;
|
||||
TickIntervalStats proc_time_;
|
||||
ApiCallStatistics api_call_statistics_;
|
||||
std::ofstream residual_echo_likelihood_graph_writer_;
|
||||
int analog_mic_level_;
|
||||
FakeRecordingDevice fake_recording_device_;
|
||||
|
||||
Reference in New Issue
Block a user