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

Unified Diff: webkit/dom_storage/dom_storage_cached_area.cc

Issue 12209085: Add histograms to track localStorage size and load time by size. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add browser histograms and rename to clarify buckets. Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/dom_storage/dom_storage_area.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/dom_storage/dom_storage_cached_area.cc
diff --git a/webkit/dom_storage/dom_storage_cached_area.cc b/webkit/dom_storage/dom_storage_cached_area.cc
index 6b20886bcb27d9894d4cbb3fb06175a08b3923a9..7ab8025a83db8136394f003ce9e47e0ed4a979b8 100644
--- a/webkit/dom_storage/dom_storage_cached_area.cc
+++ b/webkit/dom_storage/dom_storage_cached_area.cc
@@ -154,10 +154,34 @@ void DomStorageCachedArea::Prime(int connection_id) {
connection_id, &values,
base::Bind(&DomStorageCachedArea::OnLoadComplete,
weak_factory_.GetWeakPtr()));
+ base::TimeDelta time_to_prime = base::TimeTicks::Now() - before;
+ // Keeping this histogram named the same (without the ForRenderer suffix)
+ // to maintain histogram continuity.
UMA_HISTOGRAM_TIMES("LocalStorage.TimeToPrimeLocalStorage",
- base::TimeTicks::Now() - before);
+ time_to_prime);
map_ = new DomStorageMap(dom_storage::kPerAreaQuota);
map_->SwapValues(&values);
+
+ size_t local_storage_size_kb = MemoryBytesUsedByCache() / 1024;
michaeln 2013/02/12 01:49:55 could use map_->bytes_used() here
willchan no longer on Chromium 2013/02/12 01:53:41 Done.
+ // Track localStorage size, from 0-6MB. Note that the maximum size should be
+ // 5MB, but we add some slop since we want to make sure the max size is always
+ // above what we see in practice, since histograms can't change.
+ UMA_HISTOGRAM_CUSTOM_COUNTS("LocalStorage.RendererLocalStorageSizeInKB",
+ local_storage_size_kb,
+ 0, 6 * 1024, 50);
+ if (local_storage_size_kb < 100) {
+ UMA_HISTOGRAM_TIMES(
+ "LocalStorage.RendererTimeToPrimeLocalStorageUnder100KB",
+ time_to_prime);
+ } else if (local_storage_size_kb < 1000) {
+ UMA_HISTOGRAM_TIMES(
+ "LocalStorage.RendererTimeToPrimeLocalStorage100KBTo1MB",
+ time_to_prime);
+ } else {
+ UMA_HISTOGRAM_TIMES(
+ "LocalStorage.RendererTimeToPrimeLocalStorage1MBTo5MB",
+ time_to_prime);
+ }
}
void DomStorageCachedArea::Reset() {
« no previous file with comments | « webkit/dom_storage/dom_storage_area.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698