diff options
author | dmurph <dmurph@chromium.org> | 2015-01-07 13:07:59 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-07 21:10:07 +0000 |
commit | 69e28f6f37f80b9a472a41ba8198d5818508100f (patch) | |
tree | b57fbb966551f44296568eb10a3723d867ccac46 /storage/browser | |
parent | 75648bb31c04beca9c3a2507343ab2bf4a5bbae0 (diff) | |
download | chromium_src-69e28f6f37f80b9a472a41ba8198d5818508100f.zip chromium_src-69e28f6f37f80b9a472a41ba8198d5818508100f.tar.gz chromium_src-69e28f6f37f80b9a472a41ba8198d5818508100f.tar.bz2 |
[Storage] Added histograms for blob storage
For finding:
* Size distribution of blob storage
* Size distribution of blob items
* Number of cases when we are exceeding internal memory for blobs.
See here for info: https://bit.ly/AutoBlobToDisk
BUG=375297
Review URL: https://codereview.chromium.org/812843005
Cr-Commit-Position: refs/heads/master@{#310367}
Diffstat (limited to 'storage/browser')
-rw-r--r-- | storage/browser/blob/blob_storage_context.cc | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/storage/browser/blob/blob_storage_context.cc b/storage/browser/blob/blob_storage_context.cc index 554c84e..9c72518 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,30 @@ 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_GT(length, 0u); + 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())); + exceeded_memory = !AppendBytesItem(target_blob_data, item.bytes(), + static_cast<int64>(length)); break; case BlobData::Item::TYPE_FILE: - AppendFileItem(target_blob_data, - item.path(), - item.offset(), - item.length(), + UMA_HISTOGRAM_COUNTS("Storage.BlobItemSize.File", length); + AppendFileItem(target_blob_data, item.path(), item.offset(), length, item.expected_modification_time()); break; case BlobData::Item::TYPE_FILE_FILESYSTEM: - AppendFileSystemFileItem(target_blob_data, - item.filesystem_url(), - item.offset(), - item.length(), + UMA_HISTOGRAM_COUNTS("Storage.BlobItemSize.FileSystem", length); + AppendFileSystemFileItem(target_blob_data, item.filesystem_url(), + item.offset(), 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,6 +180,8 @@ void BlobStorageContext::AppendBlobDataItem( NOTREACHED(); break; } + UMA_HISTOGRAM_COUNTS("Storage.Blob.StorageSizeAfterAppend", + memory_usage_ / 1024); // If we're using too much memory, drop this blob's data. // TODO(michaeln): Blob memory storage does not yet spill over to disk, @@ -198,6 +202,9 @@ void BlobStorageContext::FinishBuildingBlob( return; found->second.data->set_content_type(content_type); found->second.flags &= ~BEING_BUILT; + UMA_HISTOGRAM_BOOLEAN( + "Storage.Blob.ExceededMemory", + (found->second.flags & EXCEEDED_MEMORY) == EXCEEDED_MEMORY); } void BlobStorageContext::CancelBuildingBlob(const std::string& uuid) { |