| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkBenchmark.h" | 8 #include "SkBenchmark.h" |
| 9 #include "SkRandom.h" | 9 #include "SkRandom.h" |
| 10 #include "SkTemplates.h" | 10 #include "SkTemplates.h" |
| 11 #include "SkUtils.h" |
| 11 | 12 |
| 12 template <typename Memcpy32> | 13 template <typename Memcpy32> |
| 13 class Memcpy32Bench : public SkBenchmark { | 14 class Memcpy32Bench : public SkBenchmark { |
| 14 public: | 15 public: |
| 15 explicit Memcpy32Bench(int count, Memcpy32 memcpy32, const char* name) | 16 explicit Memcpy32Bench(int count, Memcpy32 memcpy32, const char* name) |
| 16 : fCount(count) | 17 : fCount(count) |
| 17 , fMemcpy32(memcpy32) | 18 , fMemcpy32(memcpy32) |
| 18 , fName(SkStringPrintf("%s_%d", name, count)) {} | 19 , fName(SkStringPrintf("%s_%d", name, count)) {} |
| 19 | 20 |
| 20 virtual const char* onGetName() SK_OVERRIDE { | 21 virtual const char* onGetName() SK_OVERRIDE { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 while (count --> 0) { | 141 while (count --> 0) { |
| 141 *dst++ = *src++; | 142 *dst++ = *src++; |
| 142 } | 143 } |
| 143 } | 144 } |
| 144 BENCH(memcpy32_sse2_unalign, 10) | 145 BENCH(memcpy32_sse2_unalign, 10) |
| 145 BENCH(memcpy32_sse2_unalign, 100) | 146 BENCH(memcpy32_sse2_unalign, 100) |
| 146 BENCH(memcpy32_sse2_unalign, 1000) | 147 BENCH(memcpy32_sse2_unalign, 1000) |
| 147 BENCH(memcpy32_sse2_unalign, 10000) | 148 BENCH(memcpy32_sse2_unalign, 10000) |
| 148 BENCH(memcpy32_sse2_unalign, 100000) | 149 BENCH(memcpy32_sse2_unalign, 100000) |
| 149 | 150 |
| 151 // Test our chosen best, from SkUtils.h |
| 152 BENCH(sk_memcpy32, 10) |
| 153 BENCH(sk_memcpy32, 100) |
| 154 BENCH(sk_memcpy32, 1000) |
| 155 BENCH(sk_memcpy32, 10000) |
| 156 BENCH(sk_memcpy32, 100000) |
| 157 |
| 150 #endif // SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 | 158 #endif // SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 |
| 151 | 159 |
| 152 #undef BENCH | 160 #undef BENCH |
| OLD | NEW |