Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: media/base/sinc_resampler_perftest.cc

Issue 70833002: Fix demuxer_perftest file paths and adjust various perftests' iterations/units. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/base/demuxer_perftest.cc ('k') | media/base/vector_math_perftest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/cpu.h" 7 #include "base/cpu.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "media/base/sinc_resampler.h" 9 #include "media/base/sinc_resampler.h"
10 #include "testing/gmock/include/gmock/gmock.h" 10 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 22 matching lines...) Expand all
33 float (*convolve_fn)(const float*, const float*, const float*, double), 33 float (*convolve_fn)(const float*, const float*, const float*, double),
34 bool aligned, 34 bool aligned,
35 const std::string& trace_name) { 35 const std::string& trace_name) {
36 base::TimeTicks start = base::TimeTicks::HighResNow(); 36 base::TimeTicks start = base::TimeTicks::HighResNow();
37 for (int i = 0; i < kBenchmarkIterations; ++i) { 37 for (int i = 0; i < kBenchmarkIterations; ++i) {
38 convolve_fn(resampler->get_kernel_for_testing() + (aligned ? 0 : 1), 38 convolve_fn(resampler->get_kernel_for_testing() + (aligned ? 0 : 1),
39 resampler->get_kernel_for_testing(), 39 resampler->get_kernel_for_testing(),
40 resampler->get_kernel_for_testing(), 40 resampler->get_kernel_for_testing(),
41 kKernelInterpolationFactor); 41 kKernelInterpolationFactor);
42 } 42 }
43 double total_time_seconds = 43 double total_time_milliseconds =
44 (base::TimeTicks::HighResNow() - start).InSecondsF(); 44 (base::TimeTicks::HighResNow() - start).InMillisecondsF();
45 perf_test::PrintResult("sinc_resampler_convolve", 45 perf_test::PrintResult("sinc_resampler_convolve",
46 "", 46 "",
47 trace_name, 47 trace_name,
48 kBenchmarkIterations / total_time_seconds, 48 kBenchmarkIterations / total_time_milliseconds,
49 "runs/s", 49 "runs/ms",
50 true); 50 true);
51 } 51 }
52 52
53 // Benchmark for the various Convolve() methods. Make sure to build with 53 // Benchmark for the various Convolve() methods. Make sure to build with
54 // branding=Chrome so that DCHECKs are compiled out when benchmarking. 54 // branding=Chrome so that DCHECKs are compiled out when benchmarking.
55 TEST(SincResamplerPerfTest, Convolve) { 55 TEST(SincResamplerPerfTest, Convolve) {
56 SincResampler resampler(kSampleRateRatio, 56 SincResampler resampler(kSampleRateRatio,
57 SincResampler::kDefaultRequestSize, 57 SincResampler::kDefaultRequestSize,
58 base::Bind(&DoNothing)); 58 base::Bind(&DoNothing));
59 59
60 RunConvolveBenchmark( 60 RunConvolveBenchmark(
61 &resampler, SincResampler::Convolve_C, true, "unoptimized_aligned"); 61 &resampler, SincResampler::Convolve_C, true, "unoptimized_aligned");
62 62
63 #if defined(CONVOLVE_FUNC) 63 #if defined(CONVOLVE_FUNC)
64 #if defined(ARCH_CPU_X86_FAMILY) 64 #if defined(ARCH_CPU_X86_FAMILY)
65 ASSERT_TRUE(base::CPU().has_sse()); 65 ASSERT_TRUE(base::CPU().has_sse());
66 #endif 66 #endif
67 RunConvolveBenchmark( 67 RunConvolveBenchmark(
68 &resampler, SincResampler::CONVOLVE_FUNC, true, "optimized_aligned"); 68 &resampler, SincResampler::CONVOLVE_FUNC, true, "optimized_aligned");
69 RunConvolveBenchmark( 69 RunConvolveBenchmark(
70 &resampler, SincResampler::CONVOLVE_FUNC, false, "optimized_unaligned"); 70 &resampler, SincResampler::CONVOLVE_FUNC, false, "optimized_unaligned");
71 #endif 71 #endif
72 } 72 }
73 73
74 #undef CONVOLVE_FUNC 74 #undef CONVOLVE_FUNC
75 75
76 } // namespace media 76 } // namespace media
OLDNEW
« no previous file with comments | « media/base/demuxer_perftest.cc ('k') | media/base/vector_math_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698