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

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

Issue 274012: Convert BlockFiles to use FilePath instead of wstring. (Closed)
Patch Set: rebase Created 11 years, 2 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 (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/file_path.h" 8 #include "base/file_path.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/perftimer.h" 10 #include "base/perftimer.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 // Creating and deleting "entries" on a block-file is something quite frequent 200 // Creating and deleting "entries" on a block-file is something quite frequent
201 // (after all, almost everything is stored on block files). The operation is 201 // (after all, almost everything is stored on block files). The operation is
202 // almost free when the file is empty, but can be expensive if the file gets 202 // almost free when the file is empty, but can be expensive if the file gets
203 // fragmented, or if we have multiple files. This test measures that scenario, 203 // fragmented, or if we have multiple files. This test measures that scenario,
204 // by using multiple, highly fragmented files. 204 // by using multiple, highly fragmented files.
205 TEST_F(DiskCacheTest, BlockFilesPerformance) { 205 TEST_F(DiskCacheTest, BlockFilesPerformance) {
206 MessageLoopForIO message_loop; 206 MessageLoopForIO message_loop;
207 207
208 ScopedTestCache test_cache; 208 ScopedTestCache test_cache;
209 209
210 disk_cache::BlockFiles files(test_cache.path_wstring()); 210 disk_cache::BlockFiles files(test_cache.path());
211 ASSERT_TRUE(files.Init(true)); 211 ASSERT_TRUE(files.Init(true));
212 212
213 int seed = static_cast<int>(Time::Now().ToInternalValue()); 213 int seed = static_cast<int>(Time::Now().ToInternalValue());
214 srand(seed); 214 srand(seed);
215 215
216 const int kNumEntries = 60000; 216 const int kNumEntries = 60000;
217 disk_cache::Addr* address = new disk_cache::Addr[kNumEntries]; 217 disk_cache::Addr* address = new disk_cache::Addr[kNumEntries];
218 218
219 PerfTimeLogger timer1("Fill three block-files"); 219 PerfTimeLogger timer1("Fill three block-files");
220 220
(...skipping 13 matching lines...) Expand all
234 234
235 files.DeleteBlock(address[entry], false); 235 files.DeleteBlock(address[entry], false);
236 EXPECT_TRUE(files.CreateBlock(disk_cache::RANKINGS, BlockSize(), 236 EXPECT_TRUE(files.CreateBlock(disk_cache::RANKINGS, BlockSize(),
237 &address[entry])); 237 &address[entry]));
238 } 238 }
239 239
240 timer2.Done(); 240 timer2.Done();
241 MessageLoop::current()->RunAllPending(); 241 MessageLoop::current()->RunAllPending();
242 delete[] address; 242 delete[] address;
243 } 243 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698