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

Unified Diff: components/metrics/file_metrics_provider.cc

Issue 2966773002: Add histograms to learn about metrics files dropped for lack of an embedded profile. (Closed)
Patch Set: Created 3 years, 6 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: components/metrics/file_metrics_provider.cc
diff --git a/components/metrics/file_metrics_provider.cc b/components/metrics/file_metrics_provider.cc
index 61297c6e32b198084f64e80e1f2d339cbb8c3b6f..cfc38ff73ee8161264059d7ef00e945cc4eb63ba 100644
--- a/components/metrics/file_metrics_provider.cc
+++ b/components/metrics/file_metrics_provider.cc
@@ -546,6 +546,30 @@ bool FileMetricsProvider::ProvideIndependentMetrics(
RecordEmbeddedProfileResult(EMBEDDED_PROFILE_FOUND);
} else {
RecordEmbeddedProfileResult(EMBEDDED_PROFILE_DROPPED);
+
+ // TODO(bcwhite): Remove these once crbug/695880 is resolved.
+
+ int histogram_count = 0;
+ base::PersistentHistogramAllocator::Iterator histogram_iter(
+ source->allocator.get());
+ while (true) {
+ std::unique_ptr<base::HistogramBase> histogram =
+ histogram_iter.GetNext();
+ if (!histogram)
+ break;
+ ++histogram_count;
+ }
Alexei Svitkine (slow) 2017/06/30 14:50:10 Nit: How about: while (histogram_iter.GetNext())
bcwhite 2017/06/30 15:12:15 Done.
+ UMA_HISTOGRAM_COUNTS_1000(
Alexei Svitkine (slow) 2017/06/30 14:50:10 Nit: Suggest using 10k version of the macro becaus
bcwhite 2017/06/30 15:12:16 Done. It doesn't really matter either way. If it
+ "UMA.FileMetricsProvider.EmbeddedProfile.DroppedHistogramCount",
+ histogram_count);
+
+ base::File::Info info;
+ if (base::GetFileInfo(source->path, &info)) {
+ UMA_HISTOGRAM_CUSTOM_TIMES(
+ "UMA.FileMetricsProvider.EmbeddedProfile.DroppedFileAge",
+ base::Time::Now() - info.last_modified,
+ base::TimeDelta::FromSeconds(1), base::TimeDelta::FromDays(1), 100);
Alexei Svitkine (slow) 2017/06/30 14:50:10 I think logging in ms is not useful here, so you d
bcwhite 2017/06/30 15:12:16 Done.
+ }
}
// Regardless of whether this source was successfully recorded, it is never
« 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