| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/common/discardable_shared_memory_heap.h" | 5 #include "content/common/discardable_shared_memory_heap.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <cstdlib> | 9 #include <cstdlib> |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 const size_t kBlocks = 4096; | 32 const size_t kBlocks = 4096; |
| 33 const size_t kSegments = 16; | 33 const size_t kSegments = 16; |
| 34 size_t segment_size = block_size * kBlocks; | 34 size_t segment_size = block_size * kBlocks; |
| 35 | 35 |
| 36 for (size_t i = 0; i < kSegments; ++i) { | 36 for (size_t i = 0; i < kSegments; ++i) { |
| 37 scoped_ptr<base::DiscardableSharedMemory> memory( | 37 scoped_ptr<base::DiscardableSharedMemory> memory( |
| 38 new base::DiscardableSharedMemory); | 38 new base::DiscardableSharedMemory); |
| 39 ASSERT_TRUE(memory->CreateAndMap(segment_size)); | 39 ASSERT_TRUE(memory->CreateAndMap(segment_size)); |
| 40 heap.MergeIntoFreeLists( | 40 heap.MergeIntoFreeLists( |
| 41 heap.Grow(memory.Pass(), segment_size, base::Bind(NullTask)).Pass()); | 41 heap.Grow(memory.Pass(), segment_size, 0, base::Bind(NullTask)).Pass()); |
| 42 } | 42 } |
| 43 | 43 |
| 44 unsigned kSeed = 1; | 44 unsigned kSeed = 1; |
| 45 // Use kSeed as seed for random number generator. | 45 // Use kSeed as seed for random number generator. |
| 46 srand(kSeed); | 46 srand(kSeed); |
| 47 | 47 |
| 48 // Pre-compute random values. | 48 // Pre-compute random values. |
| 49 int random_span[kTimeCheckInterval]; | 49 int random_span[kTimeCheckInterval]; |
| 50 size_t random_blocks[kTimeCheckInterval]; | 50 size_t random_blocks[kTimeCheckInterval]; |
| 51 for (int i = 0; i < kTimeCheckInterval; ++i) { | 51 for (int i = 0; i < kTimeCheckInterval; ++i) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 } | 88 } |
| 89 | 89 |
| 90 spans.clear(); | 90 spans.clear(); |
| 91 | 91 |
| 92 perf_test::PrintResult("search_free_list", "", "", | 92 perf_test::PrintResult("search_free_list", "", "", |
| 93 count / accumulator.InSecondsF(), "runs/s", true); | 93 count / accumulator.InSecondsF(), "runs/s", true); |
| 94 } | 94 } |
| 95 | 95 |
| 96 } // namespace | 96 } // namespace |
| 97 } // namespace content | 97 } // namespace content |
| OLD | NEW |