Redirect logs to stderr in audioproc_f.

Notably, this displays logs from the AGC.

Also add a "time per chunk" field to the perf output.

R=aluebs@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/56509004

Cr-Commit-Position: refs/heads/master@{#9302}
This commit is contained in:
Andrew MacDonald 2015-05-27 17:26:03 -07:00
parent 9b720f7016
commit b444b3f0ff
2 changed files with 10 additions and 2 deletions

View File

@ -109,6 +109,7 @@
'audioproc_debug_proto',
'audioproc_test_utils',
'audioproc_protobuf_utils',
'<(webrtc_root)/test/test.gyp:test_support',
'<(DEPTH)/third_party/gflags/gflags.gyp:gflags',
],
'sources': [ 'test/audioproc_float.cc', ],

View File

@ -21,6 +21,7 @@
#include "webrtc/modules/audio_processing/test/protobuf_utils.h"
#include "webrtc/modules/audio_processing/test/test_utils.h"
#include "webrtc/system_wrappers/interface/tick_util.h"
#include "webrtc/test/testsupport/trace_to_stderr.h"
DEFINE_string(dump, "", "The name of the debug dump file to read from.");
DEFINE_string(i, "", "The name of the input file to read from.");
@ -73,6 +74,7 @@ int main(int argc, char* argv[]) {
return 1;
}
test::TraceToStderr trace_to_stderr(true);
WavReader in_file(FLAGS_i);
// If the output format is uninitialized, use the input format.
const int out_channels =
@ -127,6 +129,8 @@ int main(int argc, char* argv[]) {
int num_chunks = 0;
while (in_file.ReadSamples(in_interleaved.size(),
&in_interleaved[0]) == in_interleaved.size()) {
// Have logs display the file time rather than wallclock time.
trace_to_stderr.SetTimeSeconds(num_chunks * 1.f / kChunksPerSecond);
FloatS16ToFloat(&in_interleaved[0], in_interleaved.size(),
&in_interleaved[0]);
Deinterleave(&in_interleaved[0], in_buf.num_frames(),
@ -155,8 +159,11 @@ int main(int argc, char* argv[]) {
num_chunks++;
}
if (FLAGS_perf) {
printf("Execution time: %.3fs\nFile time: %.2fs\n\n",
accumulated_time.Milliseconds() * 0.001f, num_chunks * 0.01f);
int64_t execution_time_ms = accumulated_time.Milliseconds();
printf("\nExecution time: %.3f s\nFile time: %.2f s\n"
"Time per chunk: %.3f ms\n",
execution_time_ms * 0.001f, num_chunks * 1.f / kChunksPerSecond,
execution_time_ms * 1.f / num_chunks);
}
return 0;
}