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

Unified Diff: content/browser/indexed_db/indexed_db_transaction.cc

Issue 2904603003: [IndexedDB] Adding txn, value, and key size metrics (Closed)
Patch Set: added histograms, fixed kb Created 3 years, 7 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
Index: content/browser/indexed_db/indexed_db_transaction.cc
diff --git a/content/browser/indexed_db/indexed_db_transaction.cc b/content/browser/indexed_db/indexed_db_transaction.cc
index 904a284651a5220be85d53d13c6958292ac8756c..f5e4a5af9723a8932137848acbd1c345c799e685 100644
--- a/content/browser/indexed_db/indexed_db_transaction.cc
+++ b/content/browser/indexed_db/indexed_db_transaction.cc
@@ -8,6 +8,7 @@
#include "base/location.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
+#include "base/metrics/histogram_macros.h"
#include "base/single_thread_task_runner.h"
#include "base/stl_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -341,6 +342,32 @@ leveldb::Status IndexedDBTransaction::CommitPhaseTwo() {
if (!used_) {
committed = true;
} else {
+ const char* time_uma_name = nullptr;
+ const char* size_uma_name = nullptr;
+ switch (mode_) {
+ case blink::kWebIDBTransactionModeReadOnly:
+ time_uma_name = "WebCore.IndexedDB.Transaction.ReadOnly.TimeActive";
+ size_uma_name = "WebCore.IndexedDB.Transaction.ReadOnly.SizeOnCommit";
+ break;
+ case blink::kWebIDBTransactionModeReadWrite:
+ time_uma_name = "WebCore.IndexedDB.Transaction.ReadWrite.TimeActive";
+ size_uma_name = "WebCore.IndexedDB.Transaction.ReadWrite.SizeOnCommit";
+ break;
+ case blink::kWebIDBTransactionModeVersionChange:
+ time_uma_name =
+ "WebCore.IndexedDB.Transaction.VersionChange.TimeActive";
+ size_uma_name =
+ "WebCore.IndexedDB.Transaction.VersionChange.SizeOnCommit";
+ break;
+ default:
+ NOTREACHED();
+ }
+ UMA_HISTOGRAM_MEDIUM_TIMES(time_uma_name,
Mark P 2017/05/24 18:57:38 I don't think these macros will work. Have you te
dmurph 2017/05/24 19:25:59 Yep, fixed.
+ base::Time::Now() - diagnostics_.start_time);
+ UMA_HISTOGRAM_MEMORY_KB(
+ size_uma_name,
+ transaction_->transaction()->GetTransactionSize() / 1024);
+
s = transaction_->CommitPhaseTwo();
committed = s.ok();
}

Powered by Google App Engine
This is Rietveld 408576698