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

Unified Diff: storage/browser/blob/blob_storage_context.cc

Issue 812843005: [Storage] Added histograms for blob storage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: storage/browser/blob/blob_storage_context.cc
diff --git a/storage/browser/blob/blob_storage_context.cc b/storage/browser/blob/blob_storage_context.cc
index 554c84e278e7725404cafe4386b69029bf114e01..2c733c603a98d82461866effcd6444bfa5746f05 100644
--- a/storage/browser/blob/blob_storage_context.cc
+++ b/storage/browser/blob/blob_storage_context.cc
@@ -8,6 +8,7 @@
#include "base/location.h"
#include "base/logging.h"
#include "base/message_loop/message_loop_proxy.h"
+#include "base/metrics/histogram.h"
#include "storage/browser/blob/blob_data_handle.h"
#include "storage/common/blob/blob_data.h"
#include "url/gurl.h"
@@ -143,29 +144,36 @@ void BlobStorageContext::AppendBlobDataItem(
// 4) The Blob items are expanded.
// TODO(michaeln): Would be nice to avoid copying Data items when expanding.
- DCHECK(item.length() > 0);
+ uint64 length = item.length();
+ DCHECK(length > 0);
Alexei Svitkine (slow) 2015/01/06 16:47:42 Nit: DCHECK_GT
dmurph 2015/01/06 20:15:44 Done.
+ UMA_HISTOGRAM_COUNTS("Storage.Blob.StorageSizeBeforeAppend",
+ memory_usage_ / 1024);
switch (item.type()) {
case BlobData::Item::TYPE_BYTES:
+ UMA_HISTOGRAM_COUNTS("Storage.BlobItemSize.Bytes", length);
DCHECK(!item.offset());
exceeded_memory = !AppendBytesItem(target_blob_data,
item.bytes(),
- static_cast<int64>(item.length()));
+ static_cast<int64>(length));
break;
case BlobData::Item::TYPE_FILE:
+ UMA_HISTOGRAM_COUNTS("Storage.BlobItemSize.File", length);
AppendFileItem(target_blob_data,
item.path(),
item.offset(),
- item.length(),
+ length,
item.expected_modification_time());
break;
case BlobData::Item::TYPE_FILE_FILESYSTEM:
+ UMA_HISTOGRAM_COUNTS("Storage.BlobItemSize.FileSystem", length);
AppendFileSystemFileItem(target_blob_data,
item.filesystem_url(),
item.offset(),
- item.length(),
+ length,
item.expected_modification_time());
break;
case BlobData::Item::TYPE_BLOB: {
+ UMA_HISTOGRAM_COUNTS("Storage.BlobItemSize.Blob", length);
scoped_ptr<BlobDataHandle> src = GetBlobDataFromUUID(item.blob_uuid());
if (src)
exceeded_memory = !ExpandStorageItems(target_blob_data,
@@ -178,10 +186,13 @@ void BlobStorageContext::AppendBlobDataItem(
NOTREACHED();
break;
}
+ UMA_HISTOGRAM_COUNTS("Storage.Blob.StorageSizeAfterAppend",
+ memory_usage_ / 1024);
Alexei Svitkine (slow) 2015/01/06 16:47:41 Just wondering why you actually need both the Befo
dmurph 2015/01/06 20:15:44 I want to find the distribution of the final stora
Alexei Svitkine (slow) 2015/01/06 20:22:48 Ah, I see. You'll have to deal with some skew (i.e
// If we're using too much memory, drop this blob's data.
// TODO(michaeln): Blob memory storage does not yet spill over to disk,
// as a stop gap, we'll prevent memory usage over a max amount.
+ UMA_HISTOGRAM_BOOLEAN("Storage.BlobItem.ExceededMemory", exceeded_memory);
Alexei Svitkine (slow) 2015/01/06 16:47:42 Since exceeded memory can only happen on TYPE_BLOB
dmurph 2015/01/06 20:15:44 It's set in both TYPE_BLOB and TYPE_BYTES However,
if (exceeded_memory) {
memory_usage_ -= target_blob_data->GetMemoryUsage();
found->second.flags |= EXCEEDED_MEMORY;
« 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