| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include <stdio.h> | 11 #include <stdio.h> |
| 12 | 12 |
| 13 #include <iostream> | 13 #include <iostream> |
| 14 #include <memory> | 14 #include <memory> |
| 15 #include <sstream> | 15 #include <sstream> |
| 16 #include <string> | 16 #include <string> |
| 17 #include <utility> | 17 #include <utility> |
| 18 | 18 |
| 19 #include "gflags/gflags.h" | 19 #include "gflags/gflags.h" |
| 20 #include "webrtc/base/checks.h" | 20 #include "webrtc/base/checks.h" |
| 21 #include "webrtc/base/format_macros.h" | 21 #include "webrtc/base/format_macros.h" |
| 22 #include "webrtc/common_audio/channel_buffer.h" | 22 #include "webrtc/common_audio/channel_buffer.h" |
| 23 #include "webrtc/common_audio/wav_file.h" | 23 #include "webrtc/common_audio/wav_file.h" |
| 24 #include "webrtc/modules/audio_processing/include/audio_processing.h" | 24 #include "webrtc/modules/audio_processing/include/audio_processing.h" |
| 25 #include "webrtc/modules/audio_processing/test/audio_file_processor.h" | 25 #include "webrtc/modules/audio_processing/test/audio_file_processor.h" |
| 26 #include "webrtc/modules/audio_processing/test/protobuf_utils.h" | 26 #include "webrtc/modules/audio_processing/test/protobuf_utils.h" |
| 27 #include "webrtc/modules/audio_processing/test/test_utils.h" | 27 #include "webrtc/modules/audio_processing/test/test_utils.h" |
| 28 #include "webrtc/system_wrappers/include/tick_util.h" | |
| 29 #include "webrtc/test/testsupport/trace_to_stderr.h" | 28 #include "webrtc/test/testsupport/trace_to_stderr.h" |
| 30 | 29 |
| 31 namespace { | 30 namespace { |
| 32 | 31 |
| 33 bool ValidateOutChannels(const char* flagname, int32_t value) { | 32 bool ValidateOutChannels(const char* flagname, int32_t value) { |
| 34 return value >= 0; | 33 return value >= 0; |
| 35 } | 34 } |
| 36 | 35 |
| 37 } // namespace | 36 } // namespace |
| 38 | 37 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 } | 159 } |
| 161 | 160 |
| 162 int num_chunks = 0; | 161 int num_chunks = 0; |
| 163 while (processor->ProcessChunk()) { | 162 while (processor->ProcessChunk()) { |
| 164 trace_to_stderr.SetTimeSeconds(num_chunks * 1.f / kChunksPerSecond); | 163 trace_to_stderr.SetTimeSeconds(num_chunks * 1.f / kChunksPerSecond); |
| 165 ++num_chunks; | 164 ++num_chunks; |
| 166 } | 165 } |
| 167 | 166 |
| 168 if (FLAGS_perf) { | 167 if (FLAGS_perf) { |
| 169 const auto& proc_time = processor->proc_time(); | 168 const auto& proc_time = processor->proc_time(); |
| 170 int64_t exec_time_us = proc_time.sum.Microseconds(); | 169 int64_t exec_time_us = proc_time.sum / rtc::kNumNanosecsPerMicrosec; |
| 171 printf( | 170 printf( |
| 172 "\nExecution time: %.3f s, File time: %.2f s\n" | 171 "\nExecution time: %.3f s, File time: %.2f s\n" |
| 173 "Time per chunk (mean, max, min):\n%.0f us, %.0f us, %.0f us\n", | 172 "Time per chunk (mean, max, min):\n%.0f us, %.0f us, %.0f us\n", |
| 174 exec_time_us * 1e-6, num_chunks * 1.f / kChunksPerSecond, | 173 exec_time_us * 1e-6, num_chunks * 1.f / kChunksPerSecond, |
| 175 exec_time_us * 1.f / num_chunks, 1.f * proc_time.max.Microseconds(), | 174 exec_time_us * 1.f / num_chunks, |
| 176 1.f * proc_time.min.Microseconds()); | 175 1.f * proc_time.max / rtc::kNumNanosecsPerMicrosec, |
| 176 1.f * proc_time.min / rtc::kNumNanosecsPerMicrosec); |
| 177 } | 177 } |
| 178 | 178 |
| 179 return 0; | 179 return 0; |
| 180 } | 180 } |
| 181 | 181 |
| 182 } // namespace webrtc | 182 } // namespace webrtc |
| 183 | 183 |
| 184 int main(int argc, char* argv[]) { | 184 int main(int argc, char* argv[]) { |
| 185 return webrtc::main(argc, argv); | 185 return webrtc::main(argc, argv); |
| 186 } | 186 } |
| OLD | NEW |