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

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

Issue 864943002: Replaces instances of the deprecated TimeTicks::HighResNow() with TimeTicks::Now(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More changes based on review comments. Created 5 years, 11 months 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/sinc_resampler_unittest.cc ('k') | media/base/yuv_convert_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/memory/aligned_memory.h" 5 #include "base/memory/aligned_memory.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "media/base/vector_math.h" 8 #include "media/base/vector_math.h"
9 #include "media/base/vector_math_testing.h" 9 #include "media/base/vector_math_testing.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 18 matching lines...) Expand all
29 output_vector_.reset(static_cast<float*>(base::AlignedAlloc( 29 output_vector_.reset(static_cast<float*>(base::AlignedAlloc(
30 sizeof(float) * kVectorSize, vector_math::kRequiredAlignment))); 30 sizeof(float) * kVectorSize, vector_math::kRequiredAlignment)));
31 fill(input_vector_.get(), input_vector_.get() + kVectorSize, 1.0f); 31 fill(input_vector_.get(), input_vector_.get() + kVectorSize, 1.0f);
32 fill(output_vector_.get(), output_vector_.get() + kVectorSize, 0.0f); 32 fill(output_vector_.get(), output_vector_.get() + kVectorSize, 0.0f);
33 } 33 }
34 34
35 void RunBenchmark(void (*fn)(const float[], float, int, float[]), 35 void RunBenchmark(void (*fn)(const float[], float, int, float[]),
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::Now();
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_milliseconds = 46 double total_time_milliseconds =
47 (TimeTicks::HighResNow() - start).InMillisecondsF(); 47 (TimeTicks::Now() - start).InMillisecondsF();
48 perf_test::PrintResult(test_name, 48 perf_test::PrintResult(test_name,
49 "", 49 "",
50 trace_name, 50 trace_name,
51 kBenchmarkIterations / total_time_milliseconds, 51 kBenchmarkIterations / total_time_milliseconds,
52 "runs/ms", 52 "runs/ms",
53 true); 53 true);
54 } 54 }
55 55
56 void RunBenchmark( 56 void RunBenchmark(
57 std::pair<float, float> (*fn)(float, const float[], int, float), 57 std::pair<float, float> (*fn)(float, const float[], int, float),
58 int len, 58 int len,
59 const std::string& test_name, 59 const std::string& test_name,
60 const std::string& trace_name) { 60 const std::string& trace_name) {
61 TimeTicks start = TimeTicks::HighResNow(); 61 TimeTicks start = TimeTicks::Now();
62 for (int i = 0; i < kEWMABenchmarkIterations; ++i) { 62 for (int i = 0; i < kEWMABenchmarkIterations; ++i) {
63 fn(0.5f, input_vector_.get(), len, 0.1f); 63 fn(0.5f, input_vector_.get(), len, 0.1f);
64 } 64 }
65 double total_time_milliseconds = 65 double total_time_milliseconds =
66 (TimeTicks::HighResNow() - start).InMillisecondsF(); 66 (TimeTicks::Now() - start).InMillisecondsF();
67 perf_test::PrintResult(test_name, 67 perf_test::PrintResult(test_name,
68 "", 68 "",
69 trace_name, 69 trace_name,
70 kEWMABenchmarkIterations / total_time_milliseconds, 70 kEWMABenchmarkIterations / total_time_milliseconds,
71 "runs/ms", 71 "runs/ms",
72 true); 72 true);
73 } 73 }
74 74
75 protected: 75 protected:
76 scoped_ptr<float, base::AlignedFreeDeleter> input_vector_; 76 scoped_ptr<float, base::AlignedFreeDeleter> input_vector_;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 ASSERT_EQ(kVectorSize % (vector_math::kRequiredAlignment / sizeof(float)), 147 ASSERT_EQ(kVectorSize % (vector_math::kRequiredAlignment / sizeof(float)),
148 0U); 148 0U);
149 RunBenchmark(vector_math::EWMAAndMaxPower_FUNC, 149 RunBenchmark(vector_math::EWMAAndMaxPower_FUNC,
150 kVectorSize, 150 kVectorSize,
151 "vector_math_ewma_and_max_power", 151 "vector_math_ewma_and_max_power",
152 "optimized_aligned"); 152 "optimized_aligned");
153 #endif 153 #endif
154 } 154 }
155 155
156 } // namespace media 156 } // namespace media
OLDNEW
« no previous file with comments | « media/base/sinc_resampler_unittest.cc ('k') | media/base/yuv_convert_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698