summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-12 04:56:11 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-12 04:56:11 +0000
commitc9e9d3d206644741d5232b6dc5fa7e4bc11bc809 (patch)
tree383f64f853a00e1a25163557069dd8166785ca13 /webkit
parentffaca9f7e3fe10bd53a2ee76a3dae81307bb88f1 (diff)
downloadchromium_src-c9e9d3d206644741d5232b6dc5fa7e4bc11bc809.zip
chromium_src-c9e9d3d206644741d5232b6dc5fa7e4bc11bc809.tar.gz
chromium_src-c9e9d3d206644741d5232b6dc5fa7e4bc11bc809.tar.bz2
Add histograms to track localStorage size and load time by size.
I'm concerned that the original histograms are skewed by sample bias, since most localStorage DBs are probably small. Also introduce browser and renderer specific histograms. Kept the original histogram for the renderer one in order to maintain histogram data continuity. BUG=none Review URL: https://chromiumcodereview.appspot.com/12209085 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@181855 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/dom_storage/dom_storage_area.cc26
-rw-r--r--webkit/dom_storage/dom_storage_cached_area.cc26
2 files changed, 51 insertions, 1 deletions
diff --git a/webkit/dom_storage/dom_storage_area.cc b/webkit/dom_storage/dom_storage_area.cc
index d707a3a..3700238 100644
--- a/webkit/dom_storage/dom_storage_area.cc
+++ b/webkit/dom_storage/dom_storage_area.cc
@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/location.h"
#include "base/logging.h"
+#include "base/metrics/histogram.h"
#include "base/time.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebString.h"
#include "webkit/base/file_path_string_conversions.h"
@@ -277,10 +278,35 @@ void DomStorageArea::InitialImportIfNeeded() {
DCHECK(backing_.get());
+ base::TimeTicks before = base::TimeTicks::Now();
ValuesMap initial_values;
backing_->ReadAllValues(&initial_values);
map_->SwapValues(&initial_values);
is_initial_import_done_ = true;
+ base::TimeDelta time_to_import = base::TimeTicks::Now() - before;
+ UMA_HISTOGRAM_TIMES("LocalStorage.BrowserTimeToPrimeLocalStorage",
+ time_to_import);
+
+ size_t local_storage_size_kb = map_->bytes_used() / 1024;
+ // 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.BrowserLocalStorageSizeInKB",
+ local_storage_size_kb,
+ 0, 6 * 1024, 50);
+ if (local_storage_size_kb < 100) {
+ UMA_HISTOGRAM_TIMES(
+ "LocalStorage.BrowserTimeToPrimeLocalStorageUnder100KB",
+ time_to_import);
+ } else if (local_storage_size_kb < 1000) {
+ UMA_HISTOGRAM_TIMES(
+ "LocalStorage.BrowserTimeToPrimeLocalStorage100KBTo1MB",
+ time_to_import);
+ } else {
+ UMA_HISTOGRAM_TIMES(
+ "LocalStorage.BrowserTimeToPrimeLocalStorage1MBTo5MB",
+ time_to_import);
+ }
}
DomStorageArea::CommitBatch* DomStorageArea::CreateCommitBatchIfNeeded() {
diff --git a/webkit/dom_storage/dom_storage_cached_area.cc b/webkit/dom_storage/dom_storage_cached_area.cc
index 6b20886..30d6291 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 = map_->bytes_used() / 1024;
+ // 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() {