| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/performance_monitor/key_builder.h" | 5 #include "chrome/browser/performance_monitor/key_builder.h" |
| 6 | 6 |
| 7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "base/string_split.h" | 10 #include "base/string_split.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 enum EventKeyChar { | 48 enum EventKeyChar { |
| 49 EVENT_UNDEFINED_KEY_CHAR = 34, | 49 EVENT_UNDEFINED_KEY_CHAR = 34, |
| 50 EVENT_EXTENSION_INSTALL_KEY_CHAR = 35, | 50 EVENT_EXTENSION_INSTALL_KEY_CHAR = 35, |
| 51 EVENT_EXTENSION_UNINSTALL_KEY_CHAR = 36, | 51 EVENT_EXTENSION_UNINSTALL_KEY_CHAR = 36, |
| 52 EVENT_EXTENSION_UPDATE_KEY_CHAR = 37, | 52 EVENT_EXTENSION_UPDATE_KEY_CHAR = 37, |
| 53 EVENT_EXTENSION_ENABLE_KEY_CHAR = 38, | 53 EVENT_EXTENSION_ENABLE_KEY_CHAR = 38, |
| 54 EVENT_EXTENSION_DISABLE_KEY_CHAR = 39, | 54 EVENT_EXTENSION_DISABLE_KEY_CHAR = 39, |
| 55 EVENT_CHROME_UPDATE_KEY_CHAR = 40, | 55 EVENT_CHROME_UPDATE_KEY_CHAR = 40, |
| 56 EVENT_RENDERER_FREEZE_KEY_CHAR = 41, | 56 EVENT_RENDERER_HANG_KEY_CHAR = 41, |
| 57 EVENT_RENDERER_CRASH_KEY_CHAR = 42, | 57 EVENT_RENDERER_CRASH_KEY_CHAR = 42, |
| 58 EVENT_KILLED_BY_OS_CRASH_KEY_CHAR = 43, | 58 EVENT_RENDERER_KILLED_KEY_CHAR = 43, |
| 59 EVENT_UNCLEAN_EXIT_KEY_CHAR = 44, | 59 EVENT_UNCLEAN_EXIT_KEY_CHAR = 44, |
| 60 EVENT_NUMBER_OF_EVENTS_KEY_CHAR = 255, | 60 EVENT_NUMBER_OF_EVENTS_KEY_CHAR = 255, |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 // The position of different elements in the key for the event db. | 63 // The position of different elements in the key for the event db. |
| 64 enum EventKeyPosition { | 64 enum EventKeyPosition { |
| 65 EVENT_TIME, // The time the event was generated. | 65 EVENT_TIME, // The time the event was generated. |
| 66 EVENT_TYPE // The type of event. | 66 EVENT_TYPE // The type of event. |
| 67 }; | 67 }; |
| 68 | 68 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 event_type_to_event_key_char_[EVENT_EXTENSION_INSTALL] = | 120 event_type_to_event_key_char_[EVENT_EXTENSION_INSTALL] = |
| 121 EVENT_EXTENSION_INSTALL_KEY_CHAR; | 121 EVENT_EXTENSION_INSTALL_KEY_CHAR; |
| 122 event_type_to_event_key_char_[EVENT_EXTENSION_UNINSTALL] = | 122 event_type_to_event_key_char_[EVENT_EXTENSION_UNINSTALL] = |
| 123 EVENT_EXTENSION_UNINSTALL_KEY_CHAR; | 123 EVENT_EXTENSION_UNINSTALL_KEY_CHAR; |
| 124 event_type_to_event_key_char_[EVENT_EXTENSION_UPDATE] = | 124 event_type_to_event_key_char_[EVENT_EXTENSION_UPDATE] = |
| 125 EVENT_EXTENSION_UPDATE_KEY_CHAR; | 125 EVENT_EXTENSION_UPDATE_KEY_CHAR; |
| 126 event_type_to_event_key_char_[EVENT_EXTENSION_ENABLE] = | 126 event_type_to_event_key_char_[EVENT_EXTENSION_ENABLE] = |
| 127 EVENT_EXTENSION_ENABLE_KEY_CHAR; | 127 EVENT_EXTENSION_ENABLE_KEY_CHAR; |
| 128 event_type_to_event_key_char_[EVENT_EXTENSION_DISABLE] = | 128 event_type_to_event_key_char_[EVENT_EXTENSION_DISABLE] = |
| 129 EVENT_EXTENSION_DISABLE_KEY_CHAR; | 129 EVENT_EXTENSION_DISABLE_KEY_CHAR; |
| 130 event_type_to_event_key_char_[EVENT_RENDERER_FREEZE] = | 130 event_type_to_event_key_char_[EVENT_RENDERER_HANG] = |
| 131 EVENT_RENDERER_FREEZE_KEY_CHAR; | 131 EVENT_RENDERER_HANG_KEY_CHAR; |
| 132 event_type_to_event_key_char_[EVENT_RENDERER_CRASH] = | 132 event_type_to_event_key_char_[EVENT_RENDERER_CRASH] = |
| 133 EVENT_RENDERER_CRASH_KEY_CHAR; | 133 EVENT_RENDERER_CRASH_KEY_CHAR; |
| 134 event_type_to_event_key_char_[EVENT_KILLED_BY_OS_CRASH] = | 134 event_type_to_event_key_char_[EVENT_RENDERER_KILLED] = |
| 135 EVENT_KILLED_BY_OS_CRASH_KEY_CHAR; | 135 EVENT_RENDERER_KILLED_KEY_CHAR; |
| 136 event_type_to_event_key_char_[EVENT_UNCLEAN_EXIT] = | 136 event_type_to_event_key_char_[EVENT_UNCLEAN_EXIT] = |
| 137 EVENT_UNCLEAN_EXIT_KEY_CHAR; | 137 EVENT_UNCLEAN_EXIT_KEY_CHAR; |
| 138 event_type_to_event_key_char_[EVENT_NUMBER_OF_EVENTS] = | 138 event_type_to_event_key_char_[EVENT_NUMBER_OF_EVENTS] = |
| 139 EVENT_NUMBER_OF_EVENTS_KEY_CHAR; | 139 EVENT_NUMBER_OF_EVENTS_KEY_CHAR; |
| 140 DCHECK(event_type_to_event_key_char_.size() == EVENT_NUMBER_OF_EVENTS); | 140 DCHECK(event_type_to_event_key_char_.size() == EVENT_NUMBER_OF_EVENTS); |
| 141 | 141 |
| 142 // Generate the reverse map for easy look-up between event character mappings | 142 // Generate the reverse map for easy look-up between event character mappings |
| 143 // and event types. | 143 // and event types. |
| 144 for (int i = static_cast<int>(EVENT_UNDEFINED); | 144 for (int i = static_cast<int>(EVENT_UNDEFINED); |
| 145 i <= static_cast<int>(EVENT_NUMBER_OF_EVENTS); ++i) { | 145 i <= static_cast<int>(EVENT_NUMBER_OF_EVENTS); ++i) { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 std::vector<std::string> split; | 238 std::vector<std::string> split; |
| 239 base::SplitString(key, kDelimiter, &split); | 239 base::SplitString(key, kDelimiter, &split); |
| 240 DCHECK(split[METRIC_TYPE].size() == 1); | 240 DCHECK(split[METRIC_TYPE].size() == 1); |
| 241 return MetricKey(split[METRIC_TIME], | 241 return MetricKey(split[METRIC_TIME], |
| 242 metric_key_char_to_metric_type_[ | 242 metric_key_char_to_metric_type_[ |
| 243 static_cast<int>(split[METRIC_TYPE].at(0))], | 243 static_cast<int>(split[METRIC_TYPE].at(0))], |
| 244 split[METRIC_ACTIVITY]); | 244 split[METRIC_ACTIVITY]); |
| 245 } | 245 } |
| 246 | 246 |
| 247 } // namespace performance_monitor | 247 } // namespace performance_monitor |
| OLD | NEW |