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; |