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

Side by Side Diff: net/disk_cache/disk_cache_perftest.cc

Issue 1988833004: Better defaults for the disk cache perftest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@open-speeder-macbetter
Patch Set: Created 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <limits> 5 #include <limits>
6 #include <string> 6 #include <string>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/files/file_enumerator.h" 10 #include "base/files/file_enumerator.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 bool TimeWrite(); 72 bool TimeWrite();
73 bool TimeRead(WhatToRead what_to_read, const char* timer_message); 73 bool TimeRead(WhatToRead what_to_read, const char* timer_message);
74 void ResetAndEvictSystemDiskCache(); 74 void ResetAndEvictSystemDiskCache();
75 75
76 // Complete perf tests. 76 // Complete perf tests.
77 void CacheBackendPerformance(); 77 void CacheBackendPerformance();
78 78
79 const size_t kFdLimitForCacheTests = 8192; 79 const size_t kFdLimitForCacheTests = 8192;
80 80
81 const int kNumEntries = 1000; 81 const int kNumEntries = 1000;
82 const int kHeadersSize = 200; 82 const int kHeadersSize = 800;
83 const int kBodySize = 16 * 1024 - 1; 83 const int kBodySize = 256 * 1024 - 1;
84 84
85 std::vector<TestEntry> entries_; 85 std::vector<TestEntry> entries_;
86 86
87 private: 87 private:
88 const size_t saved_fd_limit_; 88 const size_t saved_fd_limit_;
89 }; 89 };
90 90
91 // Creates num_entries on the cache, and writes 200 bytes of metadata and up 91 // Creates num_entries on the cache, and writes kHeaderSize bytes of metadata
92 // and up
92 // to kBodySize of data to each entry. 93 // to kBodySize of data to each entry.
93 bool DiskCachePerfTest::TimeWrite() { 94 bool DiskCachePerfTest::TimeWrite() {
95 // TODO(gavinp): This test would be significantly more realistic if it didn't
96 // do single reads and writes.
Randy Smith (Not in Mondays) 2016/05/18 16:51:07 nit, suggestion: Sketch out in a bit more detail i
94 scoped_refptr<net::IOBuffer> buffer1(new net::IOBuffer(kHeadersSize)); 97 scoped_refptr<net::IOBuffer> buffer1(new net::IOBuffer(kHeadersSize));
95 scoped_refptr<net::IOBuffer> buffer2(new net::IOBuffer(kBodySize)); 98 scoped_refptr<net::IOBuffer> buffer2(new net::IOBuffer(kBodySize));
96 99
97 CacheTestFillBuffer(buffer1->data(), kHeadersSize, false); 100 CacheTestFillBuffer(buffer1->data(), kHeadersSize, false);
98 CacheTestFillBuffer(buffer2->data(), kBodySize, false); 101 CacheTestFillBuffer(buffer2->data(), kBodySize, false);
99 102
100 int expected = 0; 103 int expected = 0;
101 104
102 MessageLoopHelper helper; 105 MessageLoopHelper helper;
103 CallbackTest callback(&helper, true); 106 CallbackTest callback(&helper, true);
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 files.DeleteBlock(address[entry], false); 298 files.DeleteBlock(address[entry], false);
296 EXPECT_TRUE( 299 EXPECT_TRUE(
297 files.CreateBlock(disk_cache::RANKINGS, BlockSize(), &address[entry])); 300 files.CreateBlock(disk_cache::RANKINGS, BlockSize(), &address[entry]));
298 } 301 }
299 302
300 timer2.Done(); 303 timer2.Done();
301 base::MessageLoop::current()->RunUntilIdle(); 304 base::MessageLoop::current()->RunUntilIdle();
302 } 305 }
303 306
304 } // namespace 307 } // namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698