Commit f23e02e1 authored by Paul Jensen's avatar Paul Jensen Committed by Commit Bot

Remove unused DNS.HostCache histograms

They're not used and this change can be easily reverted to add them back.

Bug: 908717
Bug: 906936
Change-Id: I81f866c7491a84c1c5b0c87c023d3e43cf9d3a8c
Reviewed-on: https://chromium-review.googlesource.com/c/1352330Reviewed-by: default avatarMisha Efimov <mef@chromium.org>
Reviewed-by: default avatarJesse Doherty <jwd@chromium.org>
Commit-Queue: Paul Jensen <pauljensen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#611333}
parent 4a4c0b77
...@@ -183,7 +183,6 @@ HostCache::HostCache(size_t max_entries) ...@@ -183,7 +183,6 @@ HostCache::HostCache(size_t max_entries)
HostCache::~HostCache() { HostCache::~HostCache() {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
RecordEraseAll(ERASE_DESTRUCT, tick_clock_->NowTicks());
} }
const HostCache::Entry* HostCache::Lookup(const Key& key, base::TimeTicks now) { const HostCache::Entry* HostCache::Lookup(const Key& key, base::TimeTicks now) {
...@@ -192,17 +191,12 @@ const HostCache::Entry* HostCache::Lookup(const Key& key, base::TimeTicks now) { ...@@ -192,17 +191,12 @@ const HostCache::Entry* HostCache::Lookup(const Key& key, base::TimeTicks now) {
return nullptr; return nullptr;
HostCache::Entry* entry = LookupInternal(key); HostCache::Entry* entry = LookupInternal(key);
if (!entry) { if (!entry)
RecordLookup(LOOKUP_MISS_ABSENT, now, nullptr);
return nullptr; return nullptr;
} if (entry->IsStale(now, network_changes_))
if (entry->IsStale(now, network_changes_)) {
RecordLookup(LOOKUP_MISS_STALE, now, entry);
return nullptr; return nullptr;
}
entry->CountHit(/* hit_is_stale= */ false); entry->CountHit(/* hit_is_stale= */ false);
RecordLookup(LOOKUP_HIT_VALID, now, entry);
return entry; return entry;
} }
...@@ -215,14 +209,11 @@ const HostCache::Entry* HostCache::LookupStale( ...@@ -215,14 +209,11 @@ const HostCache::Entry* HostCache::LookupStale(
return nullptr; return nullptr;
HostCache::Entry* entry = LookupInternal(key); HostCache::Entry* entry = LookupInternal(key);
if (!entry) { if (!entry)
RecordLookup(LOOKUP_MISS_ABSENT, now, nullptr);
return nullptr; return nullptr;
}
bool is_stale = entry->IsStale(now, network_changes_); bool is_stale = entry->IsStale(now, network_changes_);
entry->CountHit(/* hit_is_stale= */ is_stale); entry->CountHit(/* hit_is_stale= */ is_stale);
RecordLookup(is_stale ? LOOKUP_HIT_STALE : LOOKUP_HIT_VALID, now, entry);
if (stale_out) if (stale_out)
entry->GetStaleness(now, network_changes_, stale_out); entry->GetStaleness(now, network_changes_, stale_out);
...@@ -246,8 +237,6 @@ void HostCache::Set(const Key& key, ...@@ -246,8 +237,6 @@ void HostCache::Set(const Key& key,
bool result_changed = false; bool result_changed = false;
auto it = entries_.find(key); auto it = entries_.find(key);
if (it != entries_.end()) { if (it != entries_.end()) {
bool is_stale = it->second.IsStale(now, network_changes_);
base::Optional<AddressListDeltaType> addresses_delta; base::Optional<AddressListDeltaType> addresses_delta;
if (entry.addresses() || it->second.addresses()) { if (entry.addresses() || it->second.addresses()) {
if (entry.addresses() && it->second.addresses()) { if (entry.addresses() && it->second.addresses()) {
...@@ -297,8 +286,6 @@ void HostCache::Set(const Key& key, ...@@ -297,8 +286,6 @@ void HostCache::Set(const Key& key,
std::max(addresses_delta.value(), nonaddress_delta.value()); std::max(addresses_delta.value(), nonaddress_delta.value());
} }
LogRecordSet(is_stale ? SET_UPDATE_STALE : SET_UPDATE_VALID, now,
&it->second, entry, overall_delta);
// TODO(juliatuttle): Remember some old metadata (hit count or frequency or // TODO(juliatuttle): Remember some old metadata (hit count or frequency or
// something like that) if it's useful for better eviction algorithms? // something like that) if it's useful for better eviction algorithms?
result_changed = result_changed =
...@@ -309,7 +296,6 @@ void HostCache::Set(const Key& key, ...@@ -309,7 +296,6 @@ void HostCache::Set(const Key& key,
result_changed = true; result_changed = true;
if (size() == max_entries_) if (size() == max_entries_)
EvictOneEntry(now); EvictOneEntry(now);
LogRecordSet(SET_INSERT, now, nullptr, entry, DELTA_DISJOINT);
} }
AddEntry(Key(key), Entry(entry, now, ttl, network_changes_)); AddEntry(Key(key), Entry(entry, now, ttl, network_changes_));
...@@ -338,7 +324,6 @@ void HostCache::set_persistence_delegate(PersistenceDelegate* delegate) { ...@@ -338,7 +324,6 @@ void HostCache::set_persistence_delegate(PersistenceDelegate* delegate) {
void HostCache::clear() { void HostCache::clear() {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
RecordEraseAll(ERASE_CLEAR, tick_clock_->NowTicks());
// Don't bother scheduling a write if there's nothing to clear. // Don't bother scheduling a write if there's nothing to clear.
if (size() == 0) if (size() == 0)
...@@ -359,12 +344,10 @@ void HostCache::ClearForHosts( ...@@ -359,12 +344,10 @@ void HostCache::ClearForHosts(
} }
bool changed = false; bool changed = false;
base::TimeTicks now = tick_clock_->NowTicks();
for (auto it = entries_.begin(); it != entries_.end();) { for (auto it = entries_.begin(); it != entries_.end();) {
auto next_it = std::next(it); auto next_it = std::next(it);
if (host_filter.Run(it->first.hostname)) { if (host_filter.Run(it->first.hostname)) {
RecordErase(ERASE_CLEAR, now, it->second);
entries_.erase(it); entries_.erase(it);
changed = true; changed = true;
} }
...@@ -607,110 +590,9 @@ void HostCache::EvictOneEntry(base::TimeTicks now) { ...@@ -607,110 +590,9 @@ void HostCache::EvictOneEntry(base::TimeTicks now) {
} }
} }
RecordErase(ERASE_EVICT, now, oldest_it->second);
entries_.erase(oldest_it); entries_.erase(oldest_it);
} }
void HostCache::LogRecordSet(SetOutcome outcome,
base::TimeTicks now,
const Entry* old_entry,
const Entry& new_entry,
AddressListDeltaType delta) {
CACHE_HISTOGRAM_ENUM("Set", outcome, MAX_SET_OUTCOME);
switch (outcome) {
case SET_INSERT:
case SET_UPDATE_VALID:
// Nothing to log here.
break;
case SET_UPDATE_STALE: {
EntryStaleness stale;
old_entry->GetStaleness(now, network_changes_, &stale);
CACHE_HISTOGRAM_TIME("UpdateStale.ExpiredBy", stale.expired_by);
CACHE_HISTOGRAM_COUNT("UpdateStale.NetworkChanges",
stale.network_changes);
CACHE_HISTOGRAM_COUNT("UpdateStale.StaleHits", stale.stale_hits);
if (old_entry->error() == OK && new_entry.error() == OK) {
LogRecordUpdateStale(delta, stale);
}
break;
}
case MAX_SET_OUTCOME:
NOTREACHED();
break;
}
}
void HostCache::LogRecordUpdateStale(AddressListDeltaType delta,
const EntryStaleness& stale) {
CACHE_HISTOGRAM_ENUM("UpdateStale.AddressListDelta", delta, MAX_DELTA_TYPE);
switch (delta) {
case DELTA_IDENTICAL:
CACHE_HISTOGRAM_TIME("UpdateStale.ExpiredBy_Identical", stale.expired_by);
CACHE_HISTOGRAM_COUNT("UpdateStale.NetworkChanges_Identical",
stale.network_changes);
break;
case DELTA_REORDERED:
CACHE_HISTOGRAM_TIME("UpdateStale.ExpiredBy_Reordered", stale.expired_by);
CACHE_HISTOGRAM_COUNT("UpdateStale.NetworkChanges_Reordered",
stale.network_changes);
break;
case DELTA_OVERLAP:
CACHE_HISTOGRAM_TIME("UpdateStale.ExpiredBy_Overlap", stale.expired_by);
CACHE_HISTOGRAM_COUNT("UpdateStale.NetworkChanges_Overlap",
stale.network_changes);
break;
case DELTA_DISJOINT:
CACHE_HISTOGRAM_TIME("UpdateStale.ExpiredBy_Disjoint", stale.expired_by);
CACHE_HISTOGRAM_COUNT("UpdateStale.NetworkChanges_Disjoint",
stale.network_changes);
break;
case MAX_DELTA_TYPE:
NOTREACHED();
break;
}
}
void HostCache::RecordLookup(LookupOutcome outcome,
base::TimeTicks now,
const Entry* entry) {
CACHE_HISTOGRAM_ENUM("Lookup", outcome, MAX_LOOKUP_OUTCOME);
switch (outcome) {
case LOOKUP_MISS_ABSENT:
case LOOKUP_MISS_STALE:
case LOOKUP_HIT_VALID:
// Nothing to log here.
break;
case LOOKUP_HIT_STALE:
CACHE_HISTOGRAM_TIME("LookupStale.ExpiredBy", now - entry->expires());
CACHE_HISTOGRAM_COUNT("LookupStale.NetworkChanges",
network_changes_ - entry->network_changes());
break;
case MAX_LOOKUP_OUTCOME:
NOTREACHED();
break;
}
}
void HostCache::RecordErase(EraseReason reason,
base::TimeTicks now,
const Entry& entry) {
HostCache::EntryStaleness stale;
entry.GetStaleness(now, network_changes_, &stale);
CACHE_HISTOGRAM_ENUM("Erase", reason, MAX_ERASE_REASON);
if (stale.is_stale()) {
CACHE_HISTOGRAM_TIME("EraseStale.ExpiredBy", stale.expired_by);
CACHE_HISTOGRAM_COUNT("EraseStale.NetworkChanges", stale.network_changes);
CACHE_HISTOGRAM_COUNT("EraseStale.StaleHits", entry.stale_hits());
} else {
CACHE_HISTOGRAM_TIME("EraseValid.ValidFor", -stale.expired_by);
}
}
void HostCache::RecordEraseAll(EraseReason reason, base::TimeTicks now) {
for (const auto& it : entries_)
RecordErase(reason, now, it.second);
}
bool HostCache::HasEntry(base::StringPiece hostname, bool HostCache::HasEntry(base::StringPiece hostname,
HostCache::Entry::Source* source_out, HostCache::Entry::Source* source_out,
HostCache::EntryStaleness* stale_out) { HostCache::EntryStaleness* stale_out) {
......
...@@ -276,19 +276,6 @@ class NET_EXPORT HostCache { ...@@ -276,19 +276,6 @@ class NET_EXPORT HostCache {
Entry* LookupInternal(const Key& key); Entry* LookupInternal(const Key& key);
void LogRecordSet(SetOutcome outcome,
base::TimeTicks now,
const Entry* old_entry,
const Entry& new_entry,
AddressListDeltaType delta);
void LogRecordUpdateStale(AddressListDeltaType delta,
const EntryStaleness& stale);
void RecordLookup(LookupOutcome outcome,
base::TimeTicks now,
const Entry* entry);
void RecordErase(EraseReason reason, base::TimeTicks now, const Entry& entry);
void RecordEraseAll(EraseReason reason, base::TimeTicks now);
// Returns true if this HostCache can contain no entries. // Returns true if this HostCache can contain no entries.
bool caching_is_disabled() const { return max_entries_ == 0; } bool caching_is_disabled() const { return max_entries_ == 0; }
......
...@@ -21575,12 +21575,18 @@ uploading your change for review. ...@@ -21575,12 +21575,18 @@ uploading your change for review.
</histogram> </histogram>
<histogram name="DNS.HostCache.Erase" enum="DNS.HostCache.EraseReason"> <histogram name="DNS.HostCache.Erase" enum="DNS.HostCache.EraseReason">
<obsolete>
Deprecated as of 11/2018.
</obsolete>
<owner>pauljensen@chromium.org</owner> <owner>pauljensen@chromium.org</owner>
<owner>mef@chromium.org</owner> <owner>mef@chromium.org</owner>
<summary>The reason for erasing a DNS entry from the host cache.</summary> <summary>The reason for erasing a DNS entry from the host cache.</summary>
</histogram> </histogram>
<histogram name="DNS.HostCache.EraseStale.ExpiredBy" units="ms"> <histogram name="DNS.HostCache.EraseStale.ExpiredBy" units="ms">
<obsolete>
Deprecated as of 11/2018.
</obsolete>
<owner>pauljensen@chromium.org</owner> <owner>pauljensen@chromium.org</owner>
<owner>mef@chromium.org</owner> <owner>mef@chromium.org</owner>
<summary> <summary>
...@@ -21590,6 +21596,9 @@ uploading your change for review. ...@@ -21590,6 +21596,9 @@ uploading your change for review.
</histogram> </histogram>
<histogram name="DNS.HostCache.EraseStale.NetworkChanges" units="changes"> <histogram name="DNS.HostCache.EraseStale.NetworkChanges" units="changes">
<obsolete>
Deprecated as of 11/2018.
</obsolete>
<owner>pauljensen@chromium.org</owner> <owner>pauljensen@chromium.org</owner>
<owner>mef@chromium.org</owner> <owner>mef@chromium.org</owner>
<summary> <summary>
...@@ -21599,6 +21608,9 @@ uploading your change for review. ...@@ -21599,6 +21608,9 @@ uploading your change for review.
</histogram> </histogram>
<histogram name="DNS.HostCache.EraseStale.StaleHits" units="hits"> <histogram name="DNS.HostCache.EraseStale.StaleHits" units="hits">
<obsolete>
Deprecated as of 11/2018.
</obsolete>
<owner>pauljensen@chromium.org</owner> <owner>pauljensen@chromium.org</owner>
<owner>mef@chromium.org</owner> <owner>mef@chromium.org</owner>
<summary> <summary>
...@@ -21608,6 +21620,9 @@ uploading your change for review. ...@@ -21608,6 +21620,9 @@ uploading your change for review.
</histogram> </histogram>
<histogram name="DNS.HostCache.EraseValid.ValidFor" units="ms"> <histogram name="DNS.HostCache.EraseValid.ValidFor" units="ms">
<obsolete>
Deprecated as of 11/2018.
</obsolete>
<owner>pauljensen@chromium.org</owner> <owner>pauljensen@chromium.org</owner>
<owner>mef@chromium.org</owner> <owner>mef@chromium.org</owner>
<summary> <summary>
...@@ -21617,12 +21632,18 @@ uploading your change for review. ...@@ -21617,12 +21632,18 @@ uploading your change for review.
</histogram> </histogram>
<histogram name="DNS.HostCache.Lookup" enum="DNS.HostCache.LookupOutcome"> <histogram name="DNS.HostCache.Lookup" enum="DNS.HostCache.LookupOutcome">
<obsolete>
Deprecated as of 11/2018.
</obsolete>
<owner>pauljensen@chromium.org</owner> <owner>pauljensen@chromium.org</owner>
<owner>mef@chromium.org</owner> <owner>mef@chromium.org</owner>
<summary>The outcome of looking up a DNS entry in the host cache.</summary> <summary>The outcome of looking up a DNS entry in the host cache.</summary>
</histogram> </histogram>
<histogram name="DNS.HostCache.LookupStale.ExpiredBy" units="ms"> <histogram name="DNS.HostCache.LookupStale.ExpiredBy" units="ms">
<obsolete>
Deprecated as of 11/2018.
</obsolete>
<owner>pauljensen@chromium.org</owner> <owner>pauljensen@chromium.org</owner>
<owner>mef@chromium.org</owner> <owner>mef@chromium.org</owner>
<summary> <summary>
...@@ -21632,6 +21653,9 @@ uploading your change for review. ...@@ -21632,6 +21653,9 @@ uploading your change for review.
</histogram> </histogram>
<histogram name="DNS.HostCache.LookupStale.NetworkChanges" units="changes"> <histogram name="DNS.HostCache.LookupStale.NetworkChanges" units="changes">
<obsolete>
Deprecated as of 11/2018.
</obsolete>
<owner>pauljensen@chromium.org</owner> <owner>pauljensen@chromium.org</owner>
<owner>mef@chromium.org</owner> <owner>mef@chromium.org</owner>
<summary> <summary>
...@@ -21657,6 +21681,9 @@ uploading your change for review. ...@@ -21657,6 +21681,9 @@ uploading your change for review.
</histogram> </histogram>
<histogram name="DNS.HostCache.Set" enum="DNS.HostCache.SetOutcome"> <histogram name="DNS.HostCache.Set" enum="DNS.HostCache.SetOutcome">
<obsolete>
Deprecated as of 11/2018.
</obsolete>
<owner>pauljensen@chromium.org</owner> <owner>pauljensen@chromium.org</owner>
<owner>mef@chromium.org</owner> <owner>mef@chromium.org</owner>
<summary>The outcome of setting a DNS entry in the host cache.</summary> <summary>The outcome of setting a DNS entry in the host cache.</summary>
...@@ -21664,6 +21691,9 @@ uploading your change for review. ...@@ -21664,6 +21691,9 @@ uploading your change for review.
<histogram name="DNS.HostCache.UpdateStale.AddressListDelta" <histogram name="DNS.HostCache.UpdateStale.AddressListDelta"
enum="DNS.AddressListDeltaType"> enum="DNS.AddressListDeltaType">
<obsolete>
Deprecated as of 11/2018.
</obsolete>
<owner>pauljensen@chromium.org</owner> <owner>pauljensen@chromium.org</owner>
<owner>mef@chromium.org</owner> <owner>mef@chromium.org</owner>
<summary> <summary>
...@@ -21674,6 +21704,9 @@ uploading your change for review. ...@@ -21674,6 +21704,9 @@ uploading your change for review.
</histogram> </histogram>
<histogram name="DNS.HostCache.UpdateStale.ExpiredBy" units="ms"> <histogram name="DNS.HostCache.UpdateStale.ExpiredBy" units="ms">
<obsolete>
Deprecated as of 11/2018.
</obsolete>
<owner>pauljensen@chromium.org</owner> <owner>pauljensen@chromium.org</owner>
<owner>mef@chromium.org</owner> <owner>mef@chromium.org</owner>
<summary> <summary>
...@@ -21683,6 +21716,9 @@ uploading your change for review. ...@@ -21683,6 +21716,9 @@ uploading your change for review.
</histogram> </histogram>
<histogram name="DNS.HostCache.UpdateStale.NetworkChanges" units="changes"> <histogram name="DNS.HostCache.UpdateStale.NetworkChanges" units="changes">
<obsolete>
Deprecated as of 11/2018.
</obsolete>
<owner>pauljensen@chromium.org</owner> <owner>pauljensen@chromium.org</owner>
<owner>mef@chromium.org</owner> <owner>mef@chromium.org</owner>
<summary> <summary>
...@@ -21693,6 +21729,9 @@ uploading your change for review. ...@@ -21693,6 +21729,9 @@ uploading your change for review.
</histogram> </histogram>
<histogram name="DNS.HostCache.UpdateStale.StaleHits" units="hits"> <histogram name="DNS.HostCache.UpdateStale.StaleHits" units="hits">
<obsolete>
Deprecated as of 11/2018.
</obsolete>
<owner>pauljensen@chromium.org</owner> <owner>pauljensen@chromium.org</owner>
<owner>mef@chromium.org</owner> <owner>mef@chromium.org</owner>
<summary> <summary>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment