| 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 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 int process_type, | 79 int process_type, |
| 80 ProfilerEventProto* performance_profile) { | 80 ProfilerEventProto* performance_profile) { |
| 81 for (std::vector<tracked_objects::TaskSnapshot>::const_iterator it = | 81 for (std::vector<tracked_objects::TaskSnapshot>::const_iterator it = |
| 82 profiler_data.tasks.begin(); | 82 profiler_data.tasks.begin(); |
| 83 it != profiler_data.tasks.end(); | 83 it != profiler_data.tasks.end(); |
| 84 ++it) { | 84 ++it) { |
| 85 const tracked_objects::DeathDataSnapshot& death_data = it->death_data; | 85 const tracked_objects::DeathDataSnapshot& death_data = it->death_data; |
| 86 ProfilerEventProto::TrackedObject* tracked_object = | 86 ProfilerEventProto::TrackedObject* tracked_object = |
| 87 performance_profile->add_tracked_object(); | 87 performance_profile->add_tracked_object(); |
| 88 tracked_object->set_birth_thread_name_hash( | 88 tracked_object->set_birth_thread_name_hash( |
| 89 MetricsLog::Hash(MapThreadName(it->birth.thread_name))); | 89 metrics::MetricsLog::Hash(MapThreadName(it->birth.thread_name))); |
| 90 tracked_object->set_exec_thread_name_hash( | 90 tracked_object->set_exec_thread_name_hash( |
| 91 MetricsLog::Hash(MapThreadName(it->death_thread_name))); | 91 metrics::MetricsLog::Hash(MapThreadName(it->death_thread_name))); |
| 92 tracked_object->set_source_file_name_hash( | 92 tracked_object->set_source_file_name_hash( |
| 93 MetricsLog::Hash(NormalizeFileName(it->birth.location.file_name))); | 93 metrics::MetricsLog::Hash(NormalizeFileName( |
| 94 it->birth.location.file_name))); |
| 94 tracked_object->set_source_function_name_hash( | 95 tracked_object->set_source_function_name_hash( |
| 95 MetricsLog::Hash(it->birth.location.function_name)); | 96 metrics::MetricsLog::Hash(it->birth.location.function_name)); |
| 96 tracked_object->set_source_line_number(it->birth.location.line_number); | 97 tracked_object->set_source_line_number(it->birth.location.line_number); |
| 97 tracked_object->set_exec_count(death_data.count); | 98 tracked_object->set_exec_count(death_data.count); |
| 98 tracked_object->set_exec_time_total(death_data.run_duration_sum); | 99 tracked_object->set_exec_time_total(death_data.run_duration_sum); |
| 99 tracked_object->set_exec_time_sampled(death_data.run_duration_sample); | 100 tracked_object->set_exec_time_sampled(death_data.run_duration_sample); |
| 100 tracked_object->set_queue_time_total(death_data.queue_duration_sum); | 101 tracked_object->set_queue_time_total(death_data.queue_duration_sum); |
| 101 tracked_object->set_queue_time_sampled(death_data.queue_duration_sample); | 102 tracked_object->set_queue_time_sampled(death_data.queue_duration_sample); |
| 102 tracked_object->set_process_type(AsProtobufProcessType(process_type)); | 103 tracked_object->set_process_type(AsProtobufProcessType(process_type)); |
| 103 tracked_object->set_process_id(profiler_data.process_id); | 104 tracked_object->set_process_id(profiler_data.process_id); |
| 104 } | 105 } |
| 105 } | 106 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 133 tracked_objects::TIME_SOURCE_TYPE_WALL_TIME) { | 134 tracked_objects::TIME_SOURCE_TYPE_WALL_TIME) { |
| 134 // We currently only support the default time source, wall clock time. | 135 // We currently only support the default time source, wall clock time. |
| 135 return; | 136 return; |
| 136 } | 137 } |
| 137 | 138 |
| 138 has_profiler_data_ = true; | 139 has_profiler_data_ = true; |
| 139 profiler_event_cache_.set_profile_type(ProfilerEventProto::STARTUP_PROFILE); | 140 profiler_event_cache_.set_profile_type(ProfilerEventProto::STARTUP_PROFILE); |
| 140 profiler_event_cache_.set_time_source(ProfilerEventProto::WALL_CLOCK_TIME); | 141 profiler_event_cache_.set_time_source(ProfilerEventProto::WALL_CLOCK_TIME); |
| 141 WriteProfilerData(process_data, process_type, &profiler_event_cache_); | 142 WriteProfilerData(process_data, process_type, &profiler_event_cache_); |
| 142 } | 143 } |
| OLD | NEW |