Chromium Code Reviews| Index: webrtc/modules/audio_processing/test/process_test.cc |
| diff --git a/webrtc/modules/audio_processing/test/process_test.cc b/webrtc/modules/audio_processing/test/process_test.cc |
| index 0d3921ba1852f70d667cc6e6be78614584197b08..649ca55bc84a95fc961551c78fbd3d826f5f857e 100644 |
| --- a/webrtc/modules/audio_processing/test/process_test.cc |
| +++ b/webrtc/modules/audio_processing/test/process_test.cc |
| @@ -19,13 +19,13 @@ |
| #include <memory> |
| #include "webrtc/base/format_macros.h" |
| +#include "webrtc/base/timeutils.h" |
| #include "webrtc/common.h" |
| #include "webrtc/modules/audio_processing/include/audio_processing.h" |
| #include "webrtc/modules/audio_processing/test/protobuf_utils.h" |
| #include "webrtc/modules/audio_processing/test/test_utils.h" |
| #include "webrtc/modules/include/module_common_types.h" |
| #include "webrtc/system_wrappers/include/cpu_features_wrapper.h" |
| -#include "webrtc/system_wrappers/include/tick_util.h" |
| #include "webrtc/test/testsupport/fileutils.h" |
| #include "webrtc/test/testsupport/perf_test.h" |
| #ifdef WEBRTC_ANDROID_PLATFORM_BUILD |
| @@ -558,7 +558,7 @@ void void_main(int argc, char* argv[]) { |
| int reverse_count = 0; |
| int primary_count = 0; |
| int near_read_bytes = 0; |
| - TickInterval acc_ticks; |
| + int64_t acc_ticks = 0; |
| AudioFrame far_frame; |
| AudioFrame near_frame; |
| @@ -569,8 +569,8 @@ void void_main(int argc, char* argv[]) { |
| int8_t stream_has_voice = 0; |
| float ns_speech_prob = 0.0f; |
| - TickTime t0 = TickTime::Now(); |
| - TickTime t1 = t0; |
| + int64_t t0 = rtc::TimeNanos(); |
| + int64_t t1 = t0; |
| int64_t max_time_us = 0; |
| int64_t max_time_reverse_us = 0; |
| int64_t min_time_us = 1e6; |
| @@ -672,7 +672,7 @@ void void_main(int argc, char* argv[]) { |
| } |
| if (perf_testing) { |
| - t0 = TickTime::Now(); |
| + t0 = rtc::TimeNanos(); |
| } |
| if (msg.has_data()) { |
| @@ -688,14 +688,15 @@ void void_main(int argc, char* argv[]) { |
| } |
| if (perf_testing) { |
| - t1 = TickTime::Now(); |
| - TickInterval tick_diff = t1 - t0; |
| + t1 = rtc::TimeNanos(); |
| + int64_t tick_diff = t1 - t0; |
|
stefan-webrtc
2016/04/19 09:19:12
tick_diff is a bad variable name now.
nisse-webrtc
2016/04/19 12:19:25
Renaming tick_diff --> diff_nanos and acc_ticks --
|
| acc_ticks += tick_diff; |
| - if (tick_diff.Microseconds() > max_time_reverse_us) { |
| - max_time_reverse_us = tick_diff.Microseconds(); |
| + int64_t diff_us = tick_diff / rtc::kNumNanosecsPerMicrosec; |
| + if (diff_us > max_time_reverse_us) { |
| + max_time_reverse_us = diff_us; |
| } |
| - if (tick_diff.Microseconds() < min_time_reverse_us) { |
| - min_time_reverse_us = tick_diff.Microseconds(); |
| + if (diff_us < min_time_reverse_us) { |
| + min_time_reverse_us = diff_us; |
| } |
| } |
| @@ -733,7 +734,7 @@ void void_main(int argc, char* argv[]) { |
| } |
| if (perf_testing) { |
| - t0 = TickTime::Now(); |
| + t0 = rtc::TimeNanos(); |
| } |
| ASSERT_EQ(apm->kNoError, |
| @@ -791,14 +792,15 @@ void void_main(int argc, char* argv[]) { |
| } |
| if (perf_testing) { |
| - t1 = TickTime::Now(); |
| - TickInterval tick_diff = t1 - t0; |
| + t1 = rtc::TimeNanos(); |
| + int64_t tick_diff = t1 - t0; |
|
stefan-webrtc
2016/04/19 09:19:12
diff_nanos? Same below
|
| acc_ticks += tick_diff; |
| - if (tick_diff.Microseconds() > max_time_us) { |
| - max_time_us = tick_diff.Microseconds(); |
| + int64_t diff_us = tick_diff / rtc::kNumNanosecsPerMicrosec; |
| + if (diff_us > max_time_us) { |
| + max_time_us = diff_us; |
| } |
| - if (tick_diff.Microseconds() < min_time_us) { |
| - min_time_us = tick_diff.Microseconds(); |
| + if (diff_us < min_time_us) { |
| + min_time_us = diff_us; |
| } |
| } |
| @@ -921,21 +923,22 @@ void void_main(int argc, char* argv[]) { |
| } |
| if (perf_testing) { |
| - t0 = TickTime::Now(); |
| + t0 = rtc::TimeNanos(); |
| } |
| ASSERT_EQ(apm->kNoError, |
| apm->ProcessReverseStream(&far_frame)); |
| if (perf_testing) { |
| - t1 = TickTime::Now(); |
| - TickInterval tick_diff = t1 - t0; |
| + t1 = rtc::TimeNanos(); |
| + int64_t tick_diff = t1 - t0; |
| acc_ticks += tick_diff; |
| - if (tick_diff.Microseconds() > max_time_reverse_us) { |
| - max_time_reverse_us = tick_diff.Microseconds(); |
| + int64_t diff_us = tick_diff / rtc::kNumNanosecsPerMicrosec; |
| + if (diff_us > max_time_reverse_us) { |
| + max_time_reverse_us = diff_us; |
| } |
| - if (tick_diff.Microseconds() < min_time_reverse_us) { |
| - min_time_reverse_us = tick_diff.Microseconds(); |
| + if (diff_us < min_time_reverse_us) { |
| + min_time_reverse_us = diff_us; |
| } |
| } |
| @@ -978,7 +981,7 @@ void void_main(int argc, char* argv[]) { |
| } |
| if (perf_testing) { |
| - t0 = TickTime::Now(); |
| + t0 = rtc::TimeNanos(); |
| } |
| const int capture_level_in = capture_level; |
| @@ -1026,14 +1029,15 @@ void void_main(int argc, char* argv[]) { |
| } |
| if (perf_testing) { |
| - t1 = TickTime::Now(); |
| - TickInterval tick_diff = t1 - t0; |
| + t1 = rtc::TimeNanos(); |
| + int64_t tick_diff = t1 - t0; |
| acc_ticks += tick_diff; |
| - if (tick_diff.Microseconds() > max_time_us) { |
| - max_time_us = tick_diff.Microseconds(); |
| + int64_t diff_us = tick_diff / rtc::kNumNanosecsPerMicrosec; |
| + if (diff_us > max_time_us) { |
| + max_time_us = diff_us; |
| } |
| - if (tick_diff.Microseconds() < min_time_us) { |
| - min_time_us = tick_diff.Microseconds(); |
| + if (diff_us < min_time_us) { |
| + min_time_us = diff_us; |
| } |
| } |
| @@ -1126,7 +1130,7 @@ void void_main(int argc, char* argv[]) { |
| if (perf_testing) { |
| if (primary_count > 0) { |
| - int64_t exec_time = acc_ticks.Milliseconds(); |
| + int64_t exec_time = acc_ticks / rtc::kNumNanosecsPerMillisec; |
| printf("\nTotal time: %.3f s, file time: %.2f s\n", |
| exec_time * 0.001, primary_count * 0.01); |
| printf("Time per frame: %.3f ms (average), %.3f ms (max)," |