Index: media/base/sinc_resampler_unittest.cc |
diff --git a/media/base/sinc_resampler_unittest.cc b/media/base/sinc_resampler_unittest.cc |
index 8b89a5d3808034ab4d5ad705b8f0c6fd311cde41..6cecc0b7725c1679e4a6c3ad5926c16bc3db7ec0 100644 |
--- a/media/base/sinc_resampler_unittest.cc |
+++ b/media/base/sinc_resampler_unittest.cc |
@@ -9,11 +9,8 @@ |
#include "base/bind.h" |
#include "base/bind_helpers.h" |
-#include "base/command_line.h" |
#include "base/cpu.h" |
-#include "base/logging.h" |
#include "base/strings/string_number_conversions.h" |
-#include "base/strings/stringize_macros.h" |
#include "base/time/time.h" |
#include "build/build_config.h" |
#include "media/base/sinc_resampler.h" |
@@ -27,9 +24,6 @@ namespace media { |
static const double kSampleRateRatio = 192000.0 / 44100.0; |
static const double kKernelInterpolationFactor = 0.5; |
-// Command line switch for runtime adjustment of ConvolveBenchmark iterations. |
-static const char kConvolveIterations[] = "convolve-iterations"; |
- |
// Helper class to ensure ChunkedResample() functions properly. |
class MockSource { |
public: |
@@ -161,74 +155,6 @@ TEST(SincResamplerTest, Convolve) { |
} |
#endif |
-// Benchmark for the various Convolve() methods. Make sure to build with |
-// branding=Chrome so that DCHECKs are compiled out when benchmarking. Original |
-// benchmarks were run with --convolve-iterations=50000000. |
-TEST(SincResamplerTest, ConvolveBenchmark) { |
- // Initialize a dummy resampler. |
- MockSource mock_source; |
- SincResampler resampler( |
- kSampleRateRatio, SincResampler::kDefaultRequestSize, |
- base::Bind(&MockSource::ProvideInput, base::Unretained(&mock_source))); |
- |
- // Retrieve benchmark iterations from command line. |
- int convolve_iterations = 10; |
- std::string iterations(CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
- kConvolveIterations)); |
- if (!iterations.empty()) |
- base::StringToInt(iterations, &convolve_iterations); |
- |
- printf("Benchmarking %d iterations:\n", convolve_iterations); |
- |
- // Benchmark Convolve_C(). |
- base::TimeTicks start = base::TimeTicks::HighResNow(); |
- for (int i = 0; i < convolve_iterations; ++i) { |
- resampler.Convolve_C( |
- resampler.kernel_storage_.get(), resampler.kernel_storage_.get(), |
- resampler.kernel_storage_.get(), kKernelInterpolationFactor); |
- } |
- double total_time_c_ms = |
- (base::TimeTicks::HighResNow() - start).InMillisecondsF(); |
- printf("Convolve_C took %.2fms.\n", total_time_c_ms); |
- |
-#if defined(CONVOLVE_FUNC) |
-#if defined(ARCH_CPU_X86_FAMILY) |
- ASSERT_TRUE(base::CPU().has_sse()); |
-#endif |
- |
- // Benchmark with unaligned input pointer. |
- start = base::TimeTicks::HighResNow(); |
- for (int j = 0; j < convolve_iterations; ++j) { |
- resampler.CONVOLVE_FUNC( |
- resampler.kernel_storage_.get() + 1, resampler.kernel_storage_.get(), |
- resampler.kernel_storage_.get(), kKernelInterpolationFactor); |
- } |
- double total_time_optimized_unaligned_ms = |
- (base::TimeTicks::HighResNow() - start).InMillisecondsF(); |
- printf(STRINGIZE(CONVOLVE_FUNC) " (unaligned) took %.2fms; which is %.2fx " |
- "faster than Convolve_C.\n", total_time_optimized_unaligned_ms, |
- total_time_c_ms / total_time_optimized_unaligned_ms); |
- |
- // Benchmark with aligned input pointer. |
- start = base::TimeTicks::HighResNow(); |
- for (int j = 0; j < convolve_iterations; ++j) { |
- resampler.CONVOLVE_FUNC( |
- resampler.kernel_storage_.get(), resampler.kernel_storage_.get(), |
- resampler.kernel_storage_.get(), kKernelInterpolationFactor); |
- } |
- double total_time_optimized_aligned_ms = |
- (base::TimeTicks::HighResNow() - start).InMillisecondsF(); |
- printf(STRINGIZE(CONVOLVE_FUNC) " (aligned) took %.2fms; which is %.2fx " |
- "faster than Convolve_C and %.2fx faster than " |
- STRINGIZE(CONVOLVE_FUNC) " (unaligned).\n", |
- total_time_optimized_aligned_ms, |
- total_time_c_ms / total_time_optimized_aligned_ms, |
- total_time_optimized_unaligned_ms / total_time_optimized_aligned_ms); |
-#endif |
-} |
- |
-#undef CONVOLVE_FUNC |
- |
// Fake audio source for testing the resampler. Generates a sinusoidal linear |
// chirp (http://en.wikipedia.org/wiki/Chirp) which can be tuned to stress the |
// resampler for the specific sample rate conversion being used. |