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

Side by Side Diff: components/discardable_memory/common/discardable_shared_memory_heap_perftest.cc

Issue 2459733002: Move discardable memory to //components from //content (Closed)
Patch Set: Fix build error Created 4 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
OLDNEW
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 "components/discardable_memory/common/discardable_shared_memory_heap.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <cmath> 9 #include <cmath>
10 #include <cstdlib> 10 #include <cstdlib>
11 #include <utility> 11 #include <utility>
12 12
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/callback_helpers.h" 14 #include "base/callback_helpers.h"
15 #include "base/memory/discardable_shared_memory.h" 15 #include "base/memory/discardable_shared_memory.h"
16 #include "base/memory/scoped_vector.h" 16 #include "base/memory/scoped_vector.h"
17 #include "base/process/process_metrics.h" 17 #include "base/process/process_metrics.h"
18 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
19 #include "testing/perf/perf_test.h" 19 #include "testing/perf/perf_test.h"
20 20
21 namespace content { 21 namespace discardable_memory {
22 namespace { 22 namespace {
23 23
24 const int kTimeLimitMs = 2000; 24 const int kTimeLimitMs = 2000;
25 const int kTimeCheckInterval = 8192; 25 const int kTimeCheckInterval = 8192;
26 26
27 void NullTask() { 27 void NullTask() {}
28 }
29 28
30 TEST(DiscardableSharedMemoryHeapTest, SearchFreeLists) { 29 TEST(DiscardableSharedMemoryHeapTest, SearchFreeLists) {
31 size_t block_size = base::GetPageSize(); 30 size_t block_size = base::GetPageSize();
32 DiscardableSharedMemoryHeap heap(block_size); 31 DiscardableSharedMemoryHeap heap(block_size);
33 32
34 const size_t kBlocks = 4096; 33 const size_t kBlocks = 4096;
35 const size_t kSegments = 16; 34 const size_t kSegments = 16;
36 size_t segment_size = block_size * kBlocks; 35 size_t segment_size = block_size * kBlocks;
37 int next_discardable_shared_memory_id = 0; 36 int next_discardable_shared_memory_id = 0;
38 37
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 start = now; 90 start = now;
92 } 91 }
93 92
94 spans.clear(); 93 spans.clear();
95 94
96 perf_test::PrintResult("search_free_list", "", "", 95 perf_test::PrintResult("search_free_list", "", "",
97 count / accumulator.InSecondsF(), "runs/s", true); 96 count / accumulator.InSecondsF(), "runs/s", true);
98 } 97 }
99 98
100 } // namespace 99 } // namespace
101 } // namespace content 100 } // namespace discardable_memory
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698