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

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: spacing 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 // to kBodySize of data to each entry. 92 // and up to kBodySize of data to each entry.
93 bool DiskCachePerfTest::TimeWrite() { 93 bool DiskCachePerfTest::TimeWrite() {
94 // TODO(gavinp): This test would be significantly more realistic if it didn't
95 // do single reads and writes. Perhaps entries should be written 64kb at a
96 // time. As well, not all entries should be created and written essentially
97 // simultaneously; some number of entries in flight at a time would be a
98 // likely better testing load.
94 scoped_refptr<net::IOBuffer> buffer1(new net::IOBuffer(kHeadersSize)); 99 scoped_refptr<net::IOBuffer> buffer1(new net::IOBuffer(kHeadersSize));
95 scoped_refptr<net::IOBuffer> buffer2(new net::IOBuffer(kBodySize)); 100 scoped_refptr<net::IOBuffer> buffer2(new net::IOBuffer(kBodySize));
96 101
97 CacheTestFillBuffer(buffer1->data(), kHeadersSize, false); 102 CacheTestFillBuffer(buffer1->data(), kHeadersSize, false);
98 CacheTestFillBuffer(buffer2->data(), kBodySize, false); 103 CacheTestFillBuffer(buffer2->data(), kBodySize, false);
99 104
100 int expected = 0; 105 int expected = 0;
101 106
102 MessageLoopHelper helper; 107 MessageLoopHelper helper;
103 CallbackTest callback(&helper, true); 108 CallbackTest callback(&helper, true);
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 files.DeleteBlock(address[entry], false); 300 files.DeleteBlock(address[entry], false);
296 EXPECT_TRUE( 301 EXPECT_TRUE(
297 files.CreateBlock(disk_cache::RANKINGS, BlockSize(), &address[entry])); 302 files.CreateBlock(disk_cache::RANKINGS, BlockSize(), &address[entry]));
298 } 303 }
299 304
300 timer2.Done(); 305 timer2.Done();
301 base::MessageLoop::current()->RunUntilIdle(); 306 base::MessageLoop::current()->RunUntilIdle();
302 } 307 }
303 308
304 } // namespace 309 } // 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