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

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

Issue 17507006: Disk cache v3 ref2 Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Incl IndexTable cl Created 7 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 | Annotate | Revision Log
« no previous file with comments | « net/disk_cache/block_files_unittest.cc ('k') | net/disk_cache/disk_cache_test_base.h » ('j') | 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 <string> 5 #include <string>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
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/hash.h" 10 #include "base/hash.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 208
209 // Creating and deleting "entries" on a block-file is something quite frequent 209 // Creating and deleting "entries" on a block-file is something quite frequent
210 // (after all, almost everything is stored on block files). The operation is 210 // (after all, almost everything is stored on block files). The operation is
211 // almost free when the file is empty, but can be expensive if the file gets 211 // almost free when the file is empty, but can be expensive if the file gets
212 // fragmented, or if we have multiple files. This test measures that scenario, 212 // fragmented, or if we have multiple files. This test measures that scenario,
213 // by using multiple, highly fragmented files. 213 // by using multiple, highly fragmented files.
214 TEST_F(DiskCacheTest, BlockFilesPerformance) { 214 TEST_F(DiskCacheTest, BlockFilesPerformance) {
215 ASSERT_TRUE(CleanupCacheDir()); 215 ASSERT_TRUE(CleanupCacheDir());
216 216
217 disk_cache::BlockFiles files(cache_path_); 217 disk_cache::BlockFiles files(cache_path_);
218 ASSERT_TRUE(files.Init(true)); 218 ASSERT_TRUE(files.Init(true, disk_cache::kFirstAdditionalBlockFile));
219 219
220 int seed = static_cast<int>(Time::Now().ToInternalValue()); 220 int seed = static_cast<int>(Time::Now().ToInternalValue());
221 srand(seed); 221 srand(seed);
222 222
223 const int kNumEntries = 60000; 223 const int kNumEntries = 60000;
224 disk_cache::Addr* address = new disk_cache::Addr[kNumEntries]; 224 disk_cache::Addr* address = new disk_cache::Addr[kNumEntries];
225 225
226 base::PerfTimeLogger timer1("Fill three block-files"); 226 base::PerfTimeLogger timer1("Fill three block-files");
227 227
228 // Fill up the 32-byte block file (use three files). 228 // Fill up the 32-byte block file (use three files).
(...skipping 12 matching lines...) Expand all
241 241
242 files.DeleteBlock(address[entry], false); 242 files.DeleteBlock(address[entry], false);
243 EXPECT_TRUE(files.CreateBlock(disk_cache::RANKINGS, BlockSize(), 243 EXPECT_TRUE(files.CreateBlock(disk_cache::RANKINGS, BlockSize(),
244 &address[entry])); 244 &address[entry]));
245 } 245 }
246 246
247 timer2.Done(); 247 timer2.Done();
248 base::MessageLoop::current()->RunUntilIdle(); 248 base::MessageLoop::current()->RunUntilIdle();
249 delete[] address; 249 delete[] address;
250 } 250 }
OLDNEW
« no previous file with comments | « net/disk_cache/block_files_unittest.cc ('k') | net/disk_cache/disk_cache_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698