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

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

Issue 2879893002: Restore disk_cache perf tests runnability. (Closed)
Patch Set: Created 3 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"
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/hash.h" 12 #include "base/hash.h"
13 #include "base/process/process_metrics.h" 13 #include "base/process/process_metrics.h"
14 #include "base/rand_util.h" 14 #include "base/rand_util.h"
15 #include "base/run_loop.h" 15 #include "base/run_loop.h"
16 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
17 #include "base/test/perf_time_logger.h" 17 #include "base/test/perf_time_logger.h"
18 #include "base/test/scoped_task_environment.h"
18 #include "base/test/test_file_util.h" 19 #include "base/test/test_file_util.h"
19 #include "base/threading/thread.h" 20 #include "base/threading/thread.h"
20 #include "net/base/cache_type.h" 21 #include "net/base/cache_type.h"
21 #include "net/base/io_buffer.h" 22 #include "net/base/io_buffer.h"
22 #include "net/base/net_errors.h" 23 #include "net/base/net_errors.h"
23 #include "net/base/test_completion_callback.h" 24 #include "net/base/test_completion_callback.h"
24 #include "net/disk_cache/blockfile/backend_impl.h" 25 #include "net/disk_cache/blockfile/backend_impl.h"
25 #include "net/disk_cache/blockfile/block_files.h" 26 #include "net/disk_cache/blockfile/block_files.h"
26 #include "net/disk_cache/disk_cache.h" 27 #include "net/disk_cache/disk_cache.h"
27 #include "net/disk_cache/disk_cache_test_base.h" 28 #include "net/disk_cache/disk_cache_test_base.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 const size_t kFdLimitForCacheTests = 8192; 85 const size_t kFdLimitForCacheTests = 8192;
85 86
86 const int kNumEntries = 1000; 87 const int kNumEntries = 1000;
87 const int kHeadersSize = 800; 88 const int kHeadersSize = 800;
88 const int kBodySize = 256 * 1024 - 1; 89 const int kBodySize = 256 * 1024 - 1;
89 90
90 std::vector<TestEntry> entries_; 91 std::vector<TestEntry> entries_;
91 92
92 private: 93 private:
93 const size_t saved_fd_limit_; 94 const size_t saved_fd_limit_;
95 base::test::ScopedTaskEnvironment scoped_task_environment_;
94 }; 96 };
95 97
96 // Creates num_entries on the cache, and writes kHeaderSize bytes of metadata 98 // Creates num_entries on the cache, and writes kHeaderSize bytes of metadata
97 // and up to kBodySize of data to each entry. 99 // and up to kBodySize of data to each entry.
98 bool DiskCachePerfTest::TimeWrite() { 100 bool DiskCachePerfTest::TimeWrite() {
99 // TODO(gavinp): This test would be significantly more realistic if it didn't 101 // TODO(gavinp): This test would be significantly more realistic if it didn't
100 // do single reads and writes. Perhaps entries should be written 64kb at a 102 // do single reads and writes. Perhaps entries should be written 64kb at a
101 // time. As well, not all entries should be created and written essentially 103 // time. As well, not all entries should be created and written essentially
102 // simultaneously; some number of entries in flight at a time would be a 104 // simultaneously; some number of entries in flight at a time would be a
103 // likely better testing load. 105 // likely better testing load.
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 index.SetMaxSize(kEntries); 341 index.SetMaxSize(kEntries);
340 index.UpdateEntrySize(0, 1u); 342 index.UpdateEntrySize(0, 1u);
341 evict_elapsed_ms += timer.Elapsed().InMillisecondsF(); 343 evict_elapsed_ms += timer.Elapsed().InMillisecondsF();
342 } 344 }
343 345
344 LOG(ERROR) << "Average time to evict:" << (evict_elapsed_ms / iterations) 346 LOG(ERROR) << "Average time to evict:" << (evict_elapsed_ms / iterations)
345 << "ms"; 347 << "ms";
346 } 348 }
347 349
348 } // namespace 350 } // 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