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

Unified Diff: chrome/browser/about_flags.cc

Issue 2345033002: Log base::Features in Launch.FlagsAtStartup (Closed)
Patch Set: Revert and extend ReportAboutFlagsHistogram and write a test Created 4 years, 3 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: chrome/browser/about_flags.cc
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index b57dcedf7dc67ef5c5958274de5fb298a267abac..82969f35f281dfd56e29b96506a72b3af128f3f7 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -2227,7 +2227,9 @@ void ResetAllFlags(flags_ui::FlagsStorage* flags_storage) {
void RecordUMAStatistics(flags_ui::FlagsStorage* flags_storage) {
const std::set<std::string> switches =
FlagsStateSingleton::GetFlagsState()->GetSwitchesFromFlags(flags_storage);
- ReportAboutFlagsHistogram("Launch.FlagsAtStartup", switches);
+ const std::set<std::string> features =
+ FlagsStateSingleton::GetFlagsState()->GetFeaturesFromFlags(flags_storage);
+ ReportAboutFlagsHistogram("Launch.FlagsAtStartup", switches, features);
}
base::HistogramBase::Sample GetSwitchUMAId(const std::string& switch_name) {
@@ -2235,9 +2237,17 @@ base::HistogramBase::Sample GetSwitchUMAId(const std::string& switch_name) {
base::HashMetricName(switch_name));
}
-void ReportAboutFlagsHistogram(const std::string& uma_histogram_name,
- const std::set<std::string>& flags) {
- for (const std::string& flag : flags) {
+void ReportAboutFlagsHistogram(
+ const std::string& uma_histogram_name,
+ const std::set<std::string>& switches,
+ const std::set<std::string>& features) {
+ ReportAboutFlagsHistogramSwitches(uma_histogram_name, switches);
+ ReportAboutFlagsHistogramFeatures(uma_histogram_name, features);
+}
+
+void ReportAboutFlagsHistogramSwitches(const std::string& uma_histogram_name,
+ const std::set<std::string>& switches) {
+ for (const std::string& flag : switches) {
int uma_id = about_flags::testing::kBadSwitchFormatHistogramId;
if (base::StartsWith(flag, "--", base::CompareCase::SENSITIVE)) {
// Skip '--' before switch name.
@@ -2262,6 +2272,21 @@ void ReportAboutFlagsHistogram(const std::string& uma_histogram_name,
}
}
+void ReportAboutFlagsHistogramFeatures(const std::string& uma_histogram_name,
Alexei Svitkine (slow) 2016/09/16 15:52:38 If this is not called from anywhere except this fi
lawrencewu 2016/09/16 17:12:57 Done.
+ const std::set<std::string>&features) {
+ for (const std::string& feature : features) {
+ int uma_id = about_flags::testing::kBadSwitchFormatHistogramId;
+
+ uma_id = GetSwitchUMAId(feature);
+ DVLOG(1) << "ReportAboutFlagsHistogram(): histogram='" << uma_histogram_name
+ << "' '" << feature << "', uma_id=" << uma_id;
+
+ // Sparse histogram macro does not cache the histogram, so it's safe
+ // to use macro with non-static histogram name here.
+ UMA_HISTOGRAM_SPARSE_SLOWLY(uma_histogram_name, uma_id);
+ }
+}
+
namespace testing {
const base::HistogramBase::Sample kBadSwitchFormatHistogramId = 0;

Powered by Google App Engine
This is Rietveld 408576698