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

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

Issue 3452024: Disk cache: Add a little more tracing for the stress test... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 3 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 | 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) 2006-2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2010 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/backend_impl.h" 5 #include "net/disk_cache/backend_impl.h"
6 6
7 #include "base/field_trial.h" 7 #include "base/field_trial.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/histogram.h" 10 #include "base/histogram.h"
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 scoped_ptr<Rankings::Iterator> iterator( 771 scoped_ptr<Rankings::Iterator> iterator(
772 reinterpret_cast<Rankings::Iterator*>(iter)); 772 reinterpret_cast<Rankings::Iterator*>(iter));
773 } 773 }
774 774
775 EntryImpl* BackendImpl::OpenEntryImpl(const std::string& key) { 775 EntryImpl* BackendImpl::OpenEntryImpl(const std::string& key) {
776 if (disabled_) 776 if (disabled_)
777 return NULL; 777 return NULL;
778 778
779 TimeTicks start = TimeTicks::Now(); 779 TimeTicks start = TimeTicks::Now();
780 uint32 hash = Hash(key); 780 uint32 hash = Hash(key);
781 Trace("Open hash 0x%x", hash);
781 782
782 EntryImpl* cache_entry = MatchEntry(key, hash, false); 783 EntryImpl* cache_entry = MatchEntry(key, hash, false);
783 if (!cache_entry) { 784 if (!cache_entry) {
784 stats_.OnEvent(Stats::OPEN_MISS); 785 stats_.OnEvent(Stats::OPEN_MISS);
785 return NULL; 786 return NULL;
786 } 787 }
787 788
788 if (ENTRY_NORMAL != cache_entry->entry()->Data()->state) { 789 if (ENTRY_NORMAL != cache_entry->entry()->Data()->state) {
789 // The entry was already evicted. 790 // The entry was already evicted.
790 cache_entry->Release(); 791 cache_entry->Release();
791 stats_.OnEvent(Stats::OPEN_MISS); 792 stats_.OnEvent(Stats::OPEN_MISS);
792 return NULL; 793 return NULL;
793 } 794 }
794 795
795 eviction_.OnOpenEntry(cache_entry); 796 eviction_.OnOpenEntry(cache_entry);
796 entry_count_++; 797 entry_count_++;
797 798
798 CACHE_UMA(AGE_MS, "OpenTime", GetSizeGroup(), start); 799 CACHE_UMA(AGE_MS, "OpenTime", GetSizeGroup(), start);
799 stats_.OnEvent(Stats::OPEN_HIT); 800 stats_.OnEvent(Stats::OPEN_HIT);
800 return cache_entry; 801 return cache_entry;
801 } 802 }
802 803
803 EntryImpl* BackendImpl::CreateEntryImpl(const std::string& key) { 804 EntryImpl* BackendImpl::CreateEntryImpl(const std::string& key) {
804 if (disabled_ || key.empty()) 805 if (disabled_ || key.empty())
805 return NULL; 806 return NULL;
806 807
807 TimeTicks start = TimeTicks::Now(); 808 TimeTicks start = TimeTicks::Now();
808 uint32 hash = Hash(key); 809 uint32 hash = Hash(key);
810 Trace("Create hash 0x%x", hash);
809 811
810 scoped_refptr<EntryImpl> parent; 812 scoped_refptr<EntryImpl> parent;
811 Addr entry_address(data_->table[hash & mask_]); 813 Addr entry_address(data_->table[hash & mask_]);
812 if (entry_address.is_initialized()) { 814 if (entry_address.is_initialized()) {
813 // We have an entry already. It could be the one we are looking for, or just 815 // We have an entry already. It could be the one we are looking for, or just
814 // a hash conflict. 816 // a hash conflict.
815 EntryImpl* old_entry = MatchEntry(key, hash, false); 817 EntryImpl* old_entry = MatchEntry(key, hash, false);
816 if (old_entry) 818 if (old_entry)
817 return ResurrectEntry(old_entry); 819 return ResurrectEntry(old_entry);
818 820
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
1575 cache_entry = NULL; 1577 cache_entry = NULL;
1576 } else { 1578 } else {
1577 Trace("NewEntry failed on MatchEntry 0x%x", address.value()); 1579 Trace("NewEntry failed on MatchEntry 0x%x", address.value());
1578 } 1580 }
1579 1581
1580 // Restart the search. 1582 // Restart the search.
1581 address.set_value(data_->table[hash & mask_]); 1583 address.set_value(data_->table[hash & mask_]);
1582 continue; 1584 continue;
1583 } 1585 }
1584 1586
1587 DCHECK_EQ(hash & mask_, cache_entry->entry()->Data()->hash & mask_);
1585 if (cache_entry->IsSameEntry(key, hash)) { 1588 if (cache_entry->IsSameEntry(key, hash)) {
1586 if (!cache_entry->Update()) 1589 if (!cache_entry->Update())
1587 cache_entry = NULL; 1590 cache_entry = NULL;
1588 found = true; 1591 found = true;
1589 break; 1592 break;
1590 } 1593 }
1591 if (!cache_entry->Update()) 1594 if (!cache_entry->Update())
1592 cache_entry = NULL; 1595 cache_entry = NULL;
1593 parent_entry = cache_entry; 1596 parent_entry = cache_entry;
1594 cache_entry = NULL; 1597 cache_entry = NULL;
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
2068 if (total_memory > kMaxBuffersSize || total_memory <= 0) 2071 if (total_memory > kMaxBuffersSize || total_memory <= 0)
2069 total_memory = kMaxBuffersSize; 2072 total_memory = kMaxBuffersSize;
2070 2073
2071 done = true; 2074 done = true;
2072 } 2075 }
2073 2076
2074 return static_cast<int>(total_memory); 2077 return static_cast<int>(total_memory);
2075 } 2078 }
2076 2079
2077 } // namespace disk_cache 2080 } // namespace disk_cache
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