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

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

Issue 1553493002: Global conversion of Pass()→std::move() on OS=linux chromecast=1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix fragile include order Created 4 years, 12 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 <stddef.h> 7 #include <stddef.h>
8
9 #include <algorithm> 8 #include <algorithm>
10 #include <cmath> 9 #include <cmath>
11 #include <cstdlib> 10 #include <cstdlib>
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 content {
(...skipping 11 matching lines...) Expand all
33 33
34 const size_t kBlocks = 4096; 34 const size_t kBlocks = 4096;
35 const size_t kSegments = 16; 35 const size_t kSegments = 16;
36 size_t segment_size = block_size * kBlocks; 36 size_t segment_size = block_size * kBlocks;
37 int next_discardable_shared_memory_id = 0; 37 int next_discardable_shared_memory_id = 0;
38 38
39 for (size_t i = 0; i < kSegments; ++i) { 39 for (size_t i = 0; i < kSegments; ++i) {
40 scoped_ptr<base::DiscardableSharedMemory> memory( 40 scoped_ptr<base::DiscardableSharedMemory> memory(
41 new base::DiscardableSharedMemory); 41 new base::DiscardableSharedMemory);
42 ASSERT_TRUE(memory->CreateAndMap(segment_size)); 42 ASSERT_TRUE(memory->CreateAndMap(segment_size));
43 heap.MergeIntoFreeLists(heap.Grow(memory.Pass(), segment_size, 43 heap.MergeIntoFreeLists(heap.Grow(std::move(memory), segment_size,
44 next_discardable_shared_memory_id++, 44 next_discardable_shared_memory_id++,
45 base::Bind(NullTask)).Pass()); 45 base::Bind(NullTask)));
46 } 46 }
47 47
48 unsigned kSeed = 1; 48 unsigned kSeed = 1;
49 // Use kSeed as seed for random number generator. 49 // Use kSeed as seed for random number generator.
50 srand(kSeed); 50 srand(kSeed);
51 51
52 // Pre-compute random values. 52 // Pre-compute random values.
53 int random_span[kTimeCheckInterval]; 53 int random_span[kTimeCheckInterval];
54 size_t random_blocks[kTimeCheckInterval]; 54 size_t random_blocks[kTimeCheckInterval];
55 for (int i = 0; i < kTimeCheckInterval; ++i) { 55 for (int i = 0; i < kTimeCheckInterval; ++i) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 } 92 }
93 93
94 spans.clear(); 94 spans.clear();
95 95
96 perf_test::PrintResult("search_free_list", "", "", 96 perf_test::PrintResult("search_free_list", "", "",
97 count / accumulator.InSecondsF(), "runs/s", true); 97 count / accumulator.InSecondsF(), "runs/s", true);
98 } 98 }
99 99
100 } // namespace 100 } // namespace
101 } // namespace content 101 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698