OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/profiler_metrics_provider.h" | 5 #include "chrome/browser/metrics/profiler_metrics_provider.h" |
6 | 6 |
7 #include <ctype.h> | 7 #include <ctype.h> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/tracked_objects.h" | 11 #include "base/tracked_objects.h" |
12 #include "components/metrics/metrics_log.h" | 12 #include "components/metrics/metrics_log.h" |
13 #include "components/nacl/common/nacl_process_type.h" | 13 #include "components/nacl/common/nacl_process_type.h" |
14 #include "content/public/common/process_type.h" | 14 #include "content/public/common/process_type.h" |
15 | 15 |
16 using metrics::ProfilerEventProto; | 16 using metrics::ProfilerEventProto; |
17 using tracked_objects::ProcessDataSnapshot; | 17 using tracked_objects::ProcessDataSnapshot; |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
21 ProfilerEventProto::TrackedObject::ProcessType AsProtobufProcessType( | 21 ProfilerEventProto::TrackedObject::ProcessType AsProtobufProcessType( |
22 int process_type) { | 22 int process_type) { |
23 switch (process_type) { | 23 switch (process_type) { |
24 case content::PROCESS_TYPE_BROWSER: | 24 case content::PROCESS_TYPE_BROWSER: |
25 return ProfilerEventProto::TrackedObject::BROWSER; | 25 return ProfilerEventProto::TrackedObject::BROWSER; |
26 case content::PROCESS_TYPE_RENDERER: | 26 case content::PROCESS_TYPE_RENDERER: |
27 return ProfilerEventProto::TrackedObject::RENDERER; | 27 return ProfilerEventProto::TrackedObject::RENDERER; |
28 case content::PROCESS_TYPE_PLUGIN: | 28 case content::PROCESS_TYPE_PLUGIN: |
29 return ProfilerEventProto::TrackedObject::PLUGIN; | 29 return ProfilerEventProto::TrackedObject::PLUGIN; |
30 case content::PROCESS_TYPE_WORKER: | |
31 return ProfilerEventProto::TrackedObject::WORKER; | |
32 case content::PROCESS_TYPE_UTILITY: | 30 case content::PROCESS_TYPE_UTILITY: |
33 return ProfilerEventProto::TrackedObject::UTILITY; | 31 return ProfilerEventProto::TrackedObject::UTILITY; |
34 case content::PROCESS_TYPE_ZYGOTE: | 32 case content::PROCESS_TYPE_ZYGOTE: |
35 return ProfilerEventProto::TrackedObject::ZYGOTE; | 33 return ProfilerEventProto::TrackedObject::ZYGOTE; |
36 case content::PROCESS_TYPE_SANDBOX_HELPER: | 34 case content::PROCESS_TYPE_SANDBOX_HELPER: |
37 return ProfilerEventProto::TrackedObject::SANDBOX_HELPER; | 35 return ProfilerEventProto::TrackedObject::SANDBOX_HELPER; |
38 case content::PROCESS_TYPE_GPU: | 36 case content::PROCESS_TYPE_GPU: |
39 return ProfilerEventProto::TrackedObject::GPU; | 37 return ProfilerEventProto::TrackedObject::GPU; |
40 case content::PROCESS_TYPE_PPAPI_PLUGIN: | 38 case content::PROCESS_TYPE_PPAPI_PLUGIN: |
41 return ProfilerEventProto::TrackedObject::PPAPI_PLUGIN; | 39 return ProfilerEventProto::TrackedObject::PPAPI_PLUGIN; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 tracked_objects::TIME_SOURCE_TYPE_WALL_TIME) { | 133 tracked_objects::TIME_SOURCE_TYPE_WALL_TIME) { |
136 // We currently only support the default time source, wall clock time. | 134 // We currently only support the default time source, wall clock time. |
137 return; | 135 return; |
138 } | 136 } |
139 | 137 |
140 has_profiler_data_ = true; | 138 has_profiler_data_ = true; |
141 profiler_event_cache_.set_profile_type(ProfilerEventProto::STARTUP_PROFILE); | 139 profiler_event_cache_.set_profile_type(ProfilerEventProto::STARTUP_PROFILE); |
142 profiler_event_cache_.set_time_source(ProfilerEventProto::WALL_CLOCK_TIME); | 140 profiler_event_cache_.set_time_source(ProfilerEventProto::WALL_CLOCK_TIME); |
143 WriteProfilerData(process_data, process_type, &profiler_event_cache_); | 141 WriteProfilerData(process_data, process_type, &profiler_event_cache_); |
144 } | 142 } |
OLD | NEW |