OLD | NEW |
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/cpu.h" | 5 #include "base/cpu.h" |
6 #include "base/memory/aligned_memory.h" | 6 #include "base/memory/aligned_memory.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "media/base/vector_math.h" | 9 #include "media/base/vector_math.h" |
10 #include "media/base/vector_math_testing.h" | 10 #include "media/base/vector_math_testing.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 bool aligned, | 36 bool aligned, |
37 const std::string& test_name, | 37 const std::string& test_name, |
38 const std::string& trace_name) { | 38 const std::string& trace_name) { |
39 TimeTicks start = TimeTicks::HighResNow(); | 39 TimeTicks start = TimeTicks::HighResNow(); |
40 for (int i = 0; i < kBenchmarkIterations; ++i) { | 40 for (int i = 0; i < kBenchmarkIterations; ++i) { |
41 fn(input_vector_.get(), | 41 fn(input_vector_.get(), |
42 kScale, | 42 kScale, |
43 kVectorSize - (aligned ? 0 : 1), | 43 kVectorSize - (aligned ? 0 : 1), |
44 output_vector_.get()); | 44 output_vector_.get()); |
45 } | 45 } |
46 double total_time_seconds = (TimeTicks::HighResNow() - start).InSecondsF(); | 46 double total_time_milliseconds = |
| 47 (TimeTicks::HighResNow() - start).InMillisecondsF(); |
47 perf_test::PrintResult(test_name, | 48 perf_test::PrintResult(test_name, |
48 "", | 49 "", |
49 trace_name, | 50 trace_name, |
50 kBenchmarkIterations / total_time_seconds, | 51 kBenchmarkIterations / total_time_milliseconds, |
51 "runs/s", | 52 "runs/ms", |
52 true); | 53 true); |
53 } | 54 } |
54 | 55 |
55 protected: | 56 protected: |
56 scoped_ptr_malloc<float, base::ScopedPtrAlignedFree> input_vector_; | 57 scoped_ptr_malloc<float, base::ScopedPtrAlignedFree> input_vector_; |
57 scoped_ptr_malloc<float, base::ScopedPtrAlignedFree> output_vector_; | 58 scoped_ptr_malloc<float, base::ScopedPtrAlignedFree> output_vector_; |
58 | 59 |
59 DISALLOW_COPY_AND_ASSIGN(VectorMathPerfTest); | 60 DISALLOW_COPY_AND_ASSIGN(VectorMathPerfTest); |
60 }; | 61 }; |
61 | 62 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 ASSERT_EQ(kVectorSize % (vector_math::kRequiredAlignment / sizeof(float)), | 116 ASSERT_EQ(kVectorSize % (vector_math::kRequiredAlignment / sizeof(float)), |
116 0U); | 117 0U); |
117 RunBenchmark( | 118 RunBenchmark( |
118 vector_math::FMUL_FUNC, true, "vector_math_fmac", "optimized_aligned"); | 119 vector_math::FMUL_FUNC, true, "vector_math_fmac", "optimized_aligned"); |
119 #endif | 120 #endif |
120 } | 121 } |
121 | 122 |
122 #undef FMUL_FUNC | 123 #undef FMUL_FUNC |
123 | 124 |
124 } // namespace media | 125 } // namespace media |
OLD | NEW |