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

Side by Side Diff: content/common/discardable_shared_memory_heap_perftest.cc

Issue 1100073004: Adding discardable memory dump provider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase for interface changes. Created 5 years, 7 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
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 "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
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());
picksi 2015/04/29 15:30:15 Is 0 a special ID? Can we pass it as a named stati
reveman 2015/04/29 15:40:29 Maybe just add a next_discardable_shared_memory_id
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
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
OLDNEW
« no previous file with comments | « content/common/discardable_shared_memory_heap.cc ('k') | content/common/discardable_shared_memory_heap_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698