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

Side by Side Diff: net/disk_cache/simple/simple_index_file.cc

Issue 16286015: SimpleCache: more histograms watching how index is loaded. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased on top of Randy's megapatch Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/simple/simple_index_file.h" 5 #include "net/disk_cache/simple/simple_index_file.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/hash.h" 8 #include "base/hash.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 scoped_ptr<SimpleIndex::EntrySet> index_file_entries; 294 scoped_ptr<SimpleIndex::EntrySet> index_file_entries;
295 295
296 const bool index_file_exists = file_util::PathExists(index_file_path); 296 const bool index_file_exists = file_util::PathExists(index_file_path);
297 297
298 // Only load if the index is not stale. 298 // Only load if the index is not stale.
299 const bool index_stale = IsIndexFileStale(index_file_path); 299 const bool index_stale = IsIndexFileStale(index_file_path);
300 if (!index_stale) { 300 if (!index_stale) {
301 const base::TimeTicks start = base::TimeTicks::Now(); 301 const base::TimeTicks start = base::TimeTicks::Now();
302 index_file_entries = LoadFromDisk(index_file_path); 302 index_file_entries = LoadFromDisk(index_file_path);
303 UMA_HISTOGRAM_TIMES("SimpleCache.IndexLoadTime", 303 UMA_HISTOGRAM_TIMES("SimpleCache.IndexLoadTime",
304 (base::TimeTicks::Now() - start)); 304 base::TimeTicks::Now() - start);
305 UMA_HISTOGRAM_COUNTS("SimpleCache.IndexEntriesLoaded",
306 index_file_entries->size());
305 } 307 }
306 308
307 UMA_HISTOGRAM_BOOLEAN("SimpleCache.IndexStale", index_stale); 309 UMA_HISTOGRAM_BOOLEAN("SimpleCache.IndexStale", index_stale);
308 310
309 bool force_index_flush = false; 311 bool force_index_flush = false;
310 if (!index_file_entries) { 312 if (!index_file_entries) {
311 const base::TimeTicks start = base::TimeTicks::Now(); 313 const base::TimeTicks start = base::TimeTicks::Now();
312 index_file_entries = RestoreFromDisk(index_file_path); 314 index_file_entries = RestoreFromDisk(index_file_path);
313 UMA_HISTOGRAM_TIMES("SimpleCache.IndexRestoreTime", 315 UMA_HISTOGRAM_MEDIUM_TIMES("SimpleCache.IndexRestoreTime",
314 (base::TimeTicks::Now() - start)); 316 base::TimeTicks::Now() - start);
317 UMA_HISTOGRAM_COUNTS("SimpleCache.IndexEntriesRestored",
318 index_file_entries->size());
315 319
316 // When we restore from disk we write the merged index file to disk right 320 // When we restore from disk we write the merged index file to disk right
317 // away, this might save us from having to restore again next time. 321 // away, this might save us from having to restore again next time.
318 force_index_flush = true; 322 force_index_flush = true;
319 } 323 }
320 UMA_HISTOGRAM_BOOLEAN("SimpleCache.IndexCorrupt", 324 UMA_HISTOGRAM_BOOLEAN("SimpleCache.IndexCorrupt",
321 (!index_stale && force_index_flush)); 325 (!index_stale && force_index_flush));
322 326
323 // Used in histograms. Please only add new values at the end. 327 // Used in histograms. Please only add new values at the end.
324 enum { 328 enum {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 index_file_entries.get()); 407 index_file_entries.get());
404 } else { 408 } else {
405 // Summing up the total size of the entry through all the *_[0-2] files 409 // Summing up the total size of the entry through all the *_[0-2] files
406 it->second.SetEntrySize(it->second.GetEntrySize() + file_size); 410 it->second.SetEntrySize(it->second.GetEntrySize() + file_size);
407 } 411 }
408 } 412 }
409 return index_file_entries.Pass(); 413 return index_file_entries.Pass();
410 } 414 }
411 415
412 } // namespace disk_cache 416 } // namespace disk_cache
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698