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

Unified Diff: components/safe_browsing_db/v4_database.cc

Issue 2447443002: Log the size of each of the stores and complete DB on launch and after each (Closed)
Patch Set: git rebase Created 4 years, 2 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 | « components/safe_browsing_db/v4_database.h ('k') | components/safe_browsing_db/v4_local_database_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/safe_browsing_db/v4_database.cc
diff --git a/components/safe_browsing_db/v4_database.cc b/components/safe_browsing_db/v4_database.cc
index 4b0a5c146cb11f73684e44c20b6f6715dd4c5e4a..62f37226975dd4564cdbbe1c1a14f4ba5c635b39 100644
--- a/components/safe_browsing_db/v4_database.cc
+++ b/components/safe_browsing_db/v4_database.cc
@@ -18,6 +18,12 @@ using base::TimeTicks;
namespace safe_browsing {
+namespace {
+
+const char kV4DatabaseSizeMetric[] = "SafeBrowsing.V4Database.Size";
+
+} // namespace
+
// static
V4StoreFactory* V4Database::factory_ = NULL;
@@ -220,6 +226,17 @@ void V4Database::VerifyChecksumOnTaskRunner(
FROM_HERE, base::Bind(db_ready_for_updates_callback, stores_to_reset));
}
+void V4Database::RecordFileSizeHistograms() {
+ int64_t db_size = 0;
+ for (const auto& store_map_iter : *store_map_) {
+ const int64_t size =
+ store_map_iter.second->RecordAndReturnFileSize(kV4DatabaseSizeMetric);
+ db_size += size;
+ }
+ const int64_t db_size_kilobytes = static_cast<int64_t>(db_size / 1024);
+ UMA_HISTOGRAM_COUNTS(kV4DatabaseSizeMetric, db_size_kilobytes);
+}
+
ListInfo::ListInfo(const bool fetch_updates,
const std::string& filename,
const ListIdentifier& list_id,
« no previous file with comments | « components/safe_browsing_db/v4_database.h ('k') | components/safe_browsing_db/v4_local_database_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698