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

Side by Side Diff: net/disk_cache/blockfile/stats.cc

Issue 885443002: Roll Chrome into Mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase to ToT mojo Created 5 years, 10 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 | « net/disk_cache/blockfile/block_files.cc ('k') | net/dns/address_sorter_posix_unittest.cc » ('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 "net/disk_cache/blockfile/stats.h" 5 #include "net/disk_cache/blockfile/stats.h"
6 6
7 #include "base/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/bucket_ranges.h" 9 #include "base/metrics/bucket_ranges.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 25 matching lines...) Expand all
36 for (int i = 4; i >= 0; i--) { 36 for (int i = 4; i >= 0; i--) {
37 if (value & mask[i]) { 37 if (value & mask[i]) {
38 value >>= s[i]; 38 value >>= s[i];
39 result |= s[i]; 39 result |= s[i];
40 } 40 }
41 } 41 }
42 return static_cast<int>(result); 42 return static_cast<int>(result);
43 } 43 }
44 44
45 // WARNING: Add new stats only at the end, or change LoadStats(). 45 // WARNING: Add new stats only at the end, or change LoadStats().
46 static const char* kCounterNames[] = { 46 const char* const kCounterNames[] = {
47 "Open miss", 47 "Open miss",
48 "Open hit", 48 "Open hit",
49 "Create miss", 49 "Create miss",
50 "Create hit", 50 "Create hit",
51 "Resurrect hit", 51 "Resurrect hit",
52 "Create error", 52 "Create error",
53 "Trim entry", 53 "Trim entry",
54 "Doom entry", 54 "Doom entry",
55 "Doom cache", 55 "Doom cache",
56 "Invalid entry", 56 "Invalid entry",
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 int Stats::GetRatio(Counters hit, Counters miss) const { 310 int Stats::GetRatio(Counters hit, Counters miss) const {
311 int64 ratio = GetCounter(hit) * 100; 311 int64 ratio = GetCounter(hit) * 100;
312 if (!ratio) 312 if (!ratio)
313 return 0; 313 return 0;
314 314
315 ratio /= (GetCounter(hit) + GetCounter(miss)); 315 ratio /= (GetCounter(hit) + GetCounter(miss));
316 return static_cast<int>(ratio); 316 return static_cast<int>(ratio);
317 } 317 }
318 318
319 } // namespace disk_cache 319 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/disk_cache/blockfile/block_files.cc ('k') | net/dns/address_sorter_posix_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698