| 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/metrics/metrics_log.h" | 5 #include "chrome/browser/metrics/metrics_log.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "base/utf_string_conversions.h" | 25 #include "base/utf_string_conversions.h" |
| 26 #include "chrome/browser/autocomplete/autocomplete_input.h" | 26 #include "chrome/browser/autocomplete/autocomplete_input.h" |
| 27 #include "chrome/browser/autocomplete/autocomplete_log.h" | 27 #include "chrome/browser/autocomplete/autocomplete_log.h" |
| 28 #include "chrome/browser/autocomplete/autocomplete_match.h" | 28 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 29 #include "chrome/browser/autocomplete/autocomplete_provider.h" | 29 #include "chrome/browser/autocomplete/autocomplete_provider.h" |
| 30 #include "chrome/browser/autocomplete/autocomplete_result.h" | 30 #include "chrome/browser/autocomplete/autocomplete_result.h" |
| 31 #include "chrome/browser/browser_process.h" | 31 #include "chrome/browser/browser_process.h" |
| 32 #include "chrome/browser/google/google_util.h" | 32 #include "chrome/browser/google/google_util.h" |
| 33 #include "chrome/browser/plugins/plugin_prefs.h" | 33 #include "chrome/browser/plugins/plugin_prefs.h" |
| 34 #include "chrome/browser/profiles/profile_manager.h" | 34 #include "chrome/browser/profiles/profile_manager.h" |
| 35 #include "chrome/common/chrome_process_type.h" |
| 35 #include "chrome/common/chrome_version_info.h" | 36 #include "chrome/common/chrome_version_info.h" |
| 36 #include "chrome/common/logging_chrome.h" | 37 #include "chrome/common/logging_chrome.h" |
| 37 #include "chrome/common/metrics/proto/omnibox_event.pb.h" | 38 #include "chrome/common/metrics/proto/omnibox_event.pb.h" |
| 38 #include "chrome/common/metrics/proto/profiler_event.pb.h" | 39 #include "chrome/common/metrics/proto/profiler_event.pb.h" |
| 39 #include "chrome/common/metrics/proto/system_profile.pb.h" | 40 #include "chrome/common/metrics/proto/system_profile.pb.h" |
| 40 #include "chrome/common/metrics/variations/variations_util.h" | 41 #include "chrome/common/metrics/variations/variations_util.h" |
| 41 #include "chrome/common/pref_names.h" | 42 #include "chrome/common/pref_names.h" |
| 42 #include "chrome/installer/util/google_update_settings.h" | 43 #include "chrome/installer/util/google_update_settings.h" |
| 43 #include "content/public/browser/content_browser_client.h" | 44 #include "content/public/browser/content_browser_client.h" |
| 44 #include "content/public/browser/gpu_data_manager.h" | 45 #include "content/public/browser/gpu_data_manager.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 return OmniboxEventProto::Suggestion::CONTACT; | 132 return OmniboxEventProto::Suggestion::CONTACT; |
| 132 case AutocompleteMatch::BOOKMARK_TITLE: | 133 case AutocompleteMatch::BOOKMARK_TITLE: |
| 133 return OmniboxEventProto::Suggestion::BOOKMARK_TITLE; | 134 return OmniboxEventProto::Suggestion::BOOKMARK_TITLE; |
| 134 default: | 135 default: |
| 135 NOTREACHED(); | 136 NOTREACHED(); |
| 136 return OmniboxEventProto::Suggestion::UNKNOWN_RESULT_TYPE; | 137 return OmniboxEventProto::Suggestion::UNKNOWN_RESULT_TYPE; |
| 137 } | 138 } |
| 138 } | 139 } |
| 139 | 140 |
| 140 ProfilerEventProto::TrackedObject::ProcessType AsProtobufProcessType( | 141 ProfilerEventProto::TrackedObject::ProcessType AsProtobufProcessType( |
| 141 content::ProcessType process_type) { | 142 int process_type) { |
| 142 switch (process_type) { | 143 switch (process_type) { |
| 143 case content::PROCESS_TYPE_BROWSER: | 144 case content::PROCESS_TYPE_BROWSER: |
| 144 return ProfilerEventProto::TrackedObject::BROWSER; | 145 return ProfilerEventProto::TrackedObject::BROWSER; |
| 145 case content::PROCESS_TYPE_RENDERER: | 146 case content::PROCESS_TYPE_RENDERER: |
| 146 return ProfilerEventProto::TrackedObject::RENDERER; | 147 return ProfilerEventProto::TrackedObject::RENDERER; |
| 147 case content::PROCESS_TYPE_PLUGIN: | 148 case content::PROCESS_TYPE_PLUGIN: |
| 148 return ProfilerEventProto::TrackedObject::PLUGIN; | 149 return ProfilerEventProto::TrackedObject::PLUGIN; |
| 149 case content::PROCESS_TYPE_WORKER: | 150 case content::PROCESS_TYPE_WORKER: |
| 150 return ProfilerEventProto::TrackedObject::WORKER; | 151 return ProfilerEventProto::TrackedObject::WORKER; |
| 151 case content::PROCESS_TYPE_NACL_LOADER: | |
| 152 return ProfilerEventProto::TrackedObject::NACL_LOADER; | |
| 153 case content::PROCESS_TYPE_UTILITY: | 152 case content::PROCESS_TYPE_UTILITY: |
| 154 return ProfilerEventProto::TrackedObject::UTILITY; | 153 return ProfilerEventProto::TrackedObject::UTILITY; |
| 155 case content::PROCESS_TYPE_PROFILE_IMPORT: | |
| 156 return ProfilerEventProto::TrackedObject::PROFILE_IMPORT; | |
| 157 case content::PROCESS_TYPE_ZYGOTE: | 154 case content::PROCESS_TYPE_ZYGOTE: |
| 158 return ProfilerEventProto::TrackedObject::ZYGOTE; | 155 return ProfilerEventProto::TrackedObject::ZYGOTE; |
| 159 case content::PROCESS_TYPE_SANDBOX_HELPER: | 156 case content::PROCESS_TYPE_SANDBOX_HELPER: |
| 160 return ProfilerEventProto::TrackedObject::SANDBOX_HELPER; | 157 return ProfilerEventProto::TrackedObject::SANDBOX_HELPER; |
| 161 case content::PROCESS_TYPE_NACL_BROKER: | |
| 162 return ProfilerEventProto::TrackedObject::NACL_BROKER; | |
| 163 case content::PROCESS_TYPE_GPU: | 158 case content::PROCESS_TYPE_GPU: |
| 164 return ProfilerEventProto::TrackedObject::GPU; | 159 return ProfilerEventProto::TrackedObject::GPU; |
| 165 case content::PROCESS_TYPE_PPAPI_PLUGIN: | 160 case content::PROCESS_TYPE_PPAPI_PLUGIN: |
| 166 return ProfilerEventProto::TrackedObject::PPAPI_PLUGIN; | 161 return ProfilerEventProto::TrackedObject::PPAPI_PLUGIN; |
| 167 case content::PROCESS_TYPE_PPAPI_BROKER: | 162 case content::PROCESS_TYPE_PPAPI_BROKER: |
| 168 return ProfilerEventProto::TrackedObject::PPAPI_BROKER; | 163 return ProfilerEventProto::TrackedObject::PPAPI_BROKER; |
| 164 case PROCESS_TYPE_PROFILE_IMPORT: |
| 165 return ProfilerEventProto::TrackedObject::PROFILE_IMPORT; |
| 166 case PROCESS_TYPE_NACL_LOADER: |
| 167 return ProfilerEventProto::TrackedObject::NACL_LOADER; |
| 168 case PROCESS_TYPE_NACL_BROKER: |
| 169 return ProfilerEventProto::TrackedObject::NACL_BROKER; |
| 169 default: | 170 default: |
| 170 NOTREACHED(); | 171 NOTREACHED(); |
| 171 return ProfilerEventProto::TrackedObject::UNKNOWN; | 172 return ProfilerEventProto::TrackedObject::UNKNOWN; |
| 172 } | 173 } |
| 173 } | 174 } |
| 174 | 175 |
| 175 // Returns the plugin preferences corresponding for this user, if available. | 176 // Returns the plugin preferences corresponding for this user, if available. |
| 176 // If multiple user profiles are loaded, returns the preferences corresponding | 177 // If multiple user profiles are loaded, returns the preferences corresponding |
| 177 // to an arbitrary one of the profiles. | 178 // to an arbitrary one of the profiles. |
| 178 PluginPrefs* GetPluginPrefs() { | 179 PluginPrefs* GetPluginPrefs() { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 206 for (std::vector<ActiveGroupId>::const_iterator it = | 207 for (std::vector<ActiveGroupId>::const_iterator it = |
| 207 field_trial_ids.begin(); it != field_trial_ids.end(); ++it) { | 208 field_trial_ids.begin(); it != field_trial_ids.end(); ++it) { |
| 208 SystemProfileProto::FieldTrial* field_trial = | 209 SystemProfileProto::FieldTrial* field_trial = |
| 209 system_profile->add_field_trial(); | 210 system_profile->add_field_trial(); |
| 210 field_trial->set_name_id(it->name); | 211 field_trial->set_name_id(it->name); |
| 211 field_trial->set_group_id(it->group); | 212 field_trial->set_group_id(it->group); |
| 212 } | 213 } |
| 213 } | 214 } |
| 214 | 215 |
| 215 void WriteProfilerData(const ProcessDataSnapshot& profiler_data, | 216 void WriteProfilerData(const ProcessDataSnapshot& profiler_data, |
| 216 content::ProcessType process_type, | 217 int process_type, |
| 217 ProfilerEventProto* performance_profile) { | 218 ProfilerEventProto* performance_profile) { |
| 218 for (std::vector<tracked_objects::TaskSnapshot>::const_iterator it = | 219 for (std::vector<tracked_objects::TaskSnapshot>::const_iterator it = |
| 219 profiler_data.tasks.begin(); | 220 profiler_data.tasks.begin(); |
| 220 it != profiler_data.tasks.end(); ++it) { | 221 it != profiler_data.tasks.end(); ++it) { |
| 221 std::string ignored; | 222 std::string ignored; |
| 222 uint64 birth_thread_name_hash; | 223 uint64 birth_thread_name_hash; |
| 223 uint64 exec_thread_name_hash; | 224 uint64 exec_thread_name_hash; |
| 224 uint64 source_file_name_hash; | 225 uint64 source_file_name_hash; |
| 225 uint64 source_function_name_hash; | 226 uint64 source_function_name_hash; |
| 226 MetricsLogBase::CreateHashes(it->birth.thread_name, | 227 MetricsLogBase::CreateHashes(it->birth.thread_name, |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 | 876 |
| 876 #if defined(OS_CHROMEOS) | 877 #if defined(OS_CHROMEOS) |
| 877 PerfDataProto perf_data_proto; | 878 PerfDataProto perf_data_proto; |
| 878 if (perf_provider_.GetPerfData(&perf_data_proto)) | 879 if (perf_provider_.GetPerfData(&perf_data_proto)) |
| 879 uma_proto()->add_perf_data()->Swap(&perf_data_proto); | 880 uma_proto()->add_perf_data()->Swap(&perf_data_proto); |
| 880 #endif | 881 #endif |
| 881 } | 882 } |
| 882 | 883 |
| 883 void MetricsLog::RecordProfilerData( | 884 void MetricsLog::RecordProfilerData( |
| 884 const tracked_objects::ProcessDataSnapshot& process_data, | 885 const tracked_objects::ProcessDataSnapshot& process_data, |
| 885 content::ProcessType process_type) { | 886 int process_type) { |
| 886 DCHECK(!locked()); | 887 DCHECK(!locked()); |
| 887 | 888 |
| 888 if (tracked_objects::GetTimeSourceType() != | 889 if (tracked_objects::GetTimeSourceType() != |
| 889 tracked_objects::TIME_SOURCE_TYPE_WALL_TIME) { | 890 tracked_objects::TIME_SOURCE_TYPE_WALL_TIME) { |
| 890 // We currently only support the default time source, wall clock time. | 891 // We currently only support the default time source, wall clock time. |
| 891 return; | 892 return; |
| 892 } | 893 } |
| 893 | 894 |
| 894 ProfilerEventProto* profile; | 895 ProfilerEventProto* profile; |
| 895 if (!uma_proto()->profiler_event_size()) { | 896 if (!uma_proto()->profiler_event_size()) { |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1080 ProductDataToProto(google_update_metrics.google_update_data, | 1081 ProductDataToProto(google_update_metrics.google_update_data, |
| 1081 google_update->mutable_google_update_status()); | 1082 google_update->mutable_google_update_status()); |
| 1082 } | 1083 } |
| 1083 | 1084 |
| 1084 if (!google_update_metrics.product_data.version.empty()) { | 1085 if (!google_update_metrics.product_data.version.empty()) { |
| 1085 ProductDataToProto(google_update_metrics.product_data, | 1086 ProductDataToProto(google_update_metrics.product_data, |
| 1086 google_update->mutable_client_status()); | 1087 google_update->mutable_client_status()); |
| 1087 } | 1088 } |
| 1088 #endif // defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN) | 1089 #endif // defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN) |
| 1089 } | 1090 } |
| OLD | NEW |