Chromium Code Reviews| Index: chrome/browser/android/data_usage/data_use_matcher.cc |
| diff --git a/chrome/browser/android/data_usage/data_use_matcher.cc b/chrome/browser/android/data_usage/data_use_matcher.cc |
| index 8959c64ff223f3261b458c5c9ca65f4937379c5f..48031f6419db26a1a7dae7aafe24a520d4ff0359 100644 |
| --- a/chrome/browser/android/data_usage/data_use_matcher.cc |
| +++ b/chrome/browser/android/data_usage/data_use_matcher.cc |
| @@ -10,9 +10,11 @@ |
| #include <utility> |
| #include "base/memory/weak_ptr.h" |
| +#include "base/metrics/histogram_macros.h" |
| #include "base/strings/string_number_conversions.h" |
| #include "base/time/default_tick_clock.h" |
| #include "base/time/tick_clock.h" |
| +#include "base/time/time.h" |
| #include "chrome/browser/android/data_usage/external_data_use_observer.h" |
| #include "third_party/re2/src/re2/re2.h" |
| #include "url/gurl.h" |
| @@ -80,6 +82,9 @@ void DataUseMatcher::RegisterURLRegexes( |
| if (data_use_tab_model_) |
| data_use_tab_model_->OnTrackingLabelRemoved(label); |
| } |
| + UMA_HISTOGRAM_COUNTS_100("DataUsage.MatchingRulesCount", |
|
tbansal1
2016/01/13 18:06:52
Can you change this to a enumerated histogram with
tbansal1
2016/01/13 18:44:24
Sorry, better to create 2 histograms:
DataUsage.Ma
Raj
2016/01/13 23:33:51
Done.
|
| + matching_rules_.size()); |
| + |
| DCHECK(io_task_runner_); |
| // Notify |external_data_use_observer_| if it should register as a data use |
| @@ -101,7 +106,11 @@ bool DataUseMatcher::MatchesURL(const GURL& url, std::string* label) const { |
| for (const auto& matching_rule : matching_rules_) { |
| if (matching_rule->expiration() <= now_ticks) |
| continue; // skip expired matching rules. |
| - if (re2::RE2::FullMatch(url.spec(), *(matching_rule->pattern()))) { |
| + base::TimeTicks begin = base::TimeTicks::Now(); |
|
tbansal1
2016/01/13 18:06:52
This might be more useful if it records the durati
Raj
2016/01/13 23:33:51
If there are multiple regexes, the total duration
|
| + bool match = re2::RE2::FullMatch(url.spec(), *(matching_rule->pattern())); |
| + UMA_HISTOGRAM_TIMES("DataUsage.Perf.URLRegexMatchDuration", |
| + base::TimeTicks::Now() - begin); |
| + if (match) { |
| *label = matching_rule->label(); |
| return true; |
| } |