OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/spellchecker/spellcheck_host_metrics.h" | 5 #include "chrome/browser/spellchecker/spellcheck_host_metrics.h" |
6 | 6 |
7 #include "base/md5.h" | 7 #include "base/md5.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 | 9 |
10 SpellCheckHostMetrics::SpellCheckHostMetrics() | 10 SpellCheckHostMetrics::SpellCheckHostMetrics() |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 if (misspelled_word_count_ == 1) | 53 if (misspelled_word_count_ == 1) |
54 RecordReplacedWordStats(0); | 54 RecordReplacedWordStats(0); |
55 } | 55 } |
56 | 56 |
57 int percentage = (100 * misspelled_word_count_) / spellchecked_word_count_; | 57 int percentage = (100 * misspelled_word_count_) / spellchecked_word_count_; |
58 UMA_HISTOGRAM_PERCENTAGE("SpellCheck.MisspellRatio", percentage); | 58 UMA_HISTOGRAM_PERCENTAGE("SpellCheck.MisspellRatio", percentage); |
59 | 59 |
60 // Collects actual number of checked words, excluding duplication. | 60 // Collects actual number of checked words, excluding duplication. |
61 base::MD5Digest digest; | 61 base::MD5Digest digest; |
62 base::MD5Sum(reinterpret_cast<const unsigned char*>(word.c_str()), | 62 base::MD5Sum(reinterpret_cast<const unsigned char*>(word.c_str()), |
63 word.size() * sizeof(char16), &digest); | 63 word.size() * sizeof(base::char16), &digest); |
64 checked_word_hashes_.insert(base::MD5DigestToBase16(digest)); | 64 checked_word_hashes_.insert(base::MD5DigestToBase16(digest)); |
65 | 65 |
66 RecordWordCounts(); | 66 RecordWordCounts(); |
67 } | 67 } |
68 | 68 |
69 void SpellCheckHostMetrics::OnHistogramTimerExpired() { | 69 void SpellCheckHostMetrics::OnHistogramTimerExpired() { |
70 if (0 < spellchecked_word_count_) { | 70 if (0 < spellchecked_word_count_) { |
71 // Collects word checking rate, which is represented | 71 // Collects word checking rate, which is represented |
72 // as a word count per hour. | 72 // as a word count per hour. |
73 base::TimeDelta since_start = base::TimeTicks::Now() - start_time_; | 73 base::TimeDelta since_start = base::TimeTicks::Now() - start_time_; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 if (suggestion_show_count_ != last_suggestion_show_count_) { | 138 if (suggestion_show_count_ != last_suggestion_show_count_) { |
139 DCHECK(suggestion_show_count_ > last_suggestion_show_count_); | 139 DCHECK(suggestion_show_count_ > last_suggestion_show_count_); |
140 UMA_HISTOGRAM_COUNTS("SpellCheck.ShownSuggestions", suggestion_show_count_); | 140 UMA_HISTOGRAM_COUNTS("SpellCheck.ShownSuggestions", suggestion_show_count_); |
141 last_suggestion_show_count_ = suggestion_show_count_; | 141 last_suggestion_show_count_ = suggestion_show_count_; |
142 } | 142 } |
143 } | 143 } |
144 | 144 |
145 void SpellCheckHostMetrics::RecordSpellingServiceStats(bool enabled) { | 145 void SpellCheckHostMetrics::RecordSpellingServiceStats(bool enabled) { |
146 UMA_HISTOGRAM_BOOLEAN("SpellCheck.SpellingService.Enabled", enabled); | 146 UMA_HISTOGRAM_BOOLEAN("SpellCheck.SpellingService.Enabled", enabled); |
147 } | 147 } |
OLD | NEW |