Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(752)

Side by Side Diff: chrome/browser/metrics/profiler_metrics_provider.cc

Issue 318993002: Merge MetricsLog and MetricsLogBase. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: address nits Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/metrics/omnibox_metrics_provider.cc ('k') | components/components_tests.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <vector> 9 #include <vector>
9 10
10 #include "base/tracked_objects.h" 11 #include "base/tracked_objects.h"
11 #include "components/metrics/metrics_log_base.h" 12 #include "components/metrics/metrics_log.h"
12 #include "components/nacl/common/nacl_process_type.h" 13 #include "components/nacl/common/nacl_process_type.h"
13 #include "content/public/common/process_type.h" 14 #include "content/public/common/process_type.h"
14 15
15 using metrics::MetricsLogBase;
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;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 int process_type, 81 int process_type,
82 ProfilerEventProto* performance_profile) { 82 ProfilerEventProto* performance_profile) {
83 for (std::vector<tracked_objects::TaskSnapshot>::const_iterator it = 83 for (std::vector<tracked_objects::TaskSnapshot>::const_iterator it =
84 profiler_data.tasks.begin(); 84 profiler_data.tasks.begin();
85 it != profiler_data.tasks.end(); 85 it != profiler_data.tasks.end();
86 ++it) { 86 ++it) {
87 const tracked_objects::DeathDataSnapshot& death_data = it->death_data; 87 const tracked_objects::DeathDataSnapshot& death_data = it->death_data;
88 ProfilerEventProto::TrackedObject* tracked_object = 88 ProfilerEventProto::TrackedObject* tracked_object =
89 performance_profile->add_tracked_object(); 89 performance_profile->add_tracked_object();
90 tracked_object->set_birth_thread_name_hash( 90 tracked_object->set_birth_thread_name_hash(
91 MetricsLogBase::Hash(MapThreadName(it->birth.thread_name))); 91 MetricsLog::Hash(MapThreadName(it->birth.thread_name)));
92 tracked_object->set_exec_thread_name_hash( 92 tracked_object->set_exec_thread_name_hash(
93 MetricsLogBase::Hash(MapThreadName(it->death_thread_name))); 93 MetricsLog::Hash(MapThreadName(it->death_thread_name)));
94 tracked_object->set_source_file_name_hash( 94 tracked_object->set_source_file_name_hash(
95 MetricsLogBase::Hash(NormalizeFileName(it->birth.location.file_name))); 95 MetricsLog::Hash(NormalizeFileName(it->birth.location.file_name)));
96 tracked_object->set_source_function_name_hash( 96 tracked_object->set_source_function_name_hash(
97 MetricsLogBase::Hash(it->birth.location.function_name)); 97 MetricsLog::Hash(it->birth.location.function_name));
98 tracked_object->set_source_line_number(it->birth.location.line_number); 98 tracked_object->set_source_line_number(it->birth.location.line_number);
99 tracked_object->set_exec_count(death_data.count); 99 tracked_object->set_exec_count(death_data.count);
100 tracked_object->set_exec_time_total(death_data.run_duration_sum); 100 tracked_object->set_exec_time_total(death_data.run_duration_sum);
101 tracked_object->set_exec_time_sampled(death_data.run_duration_sample); 101 tracked_object->set_exec_time_sampled(death_data.run_duration_sample);
102 tracked_object->set_queue_time_total(death_data.queue_duration_sum); 102 tracked_object->set_queue_time_total(death_data.queue_duration_sum);
103 tracked_object->set_queue_time_sampled(death_data.queue_duration_sample); 103 tracked_object->set_queue_time_sampled(death_data.queue_duration_sample);
104 tracked_object->set_process_type(AsProtobufProcessType(process_type)); 104 tracked_object->set_process_type(AsProtobufProcessType(process_type));
105 tracked_object->set_process_id(profiler_data.process_id); 105 tracked_object->set_process_id(profiler_data.process_id);
106 } 106 }
107 } 107 }
(...skipping 27 matching lines...) Expand all
135 tracked_objects::TIME_SOURCE_TYPE_WALL_TIME) { 135 tracked_objects::TIME_SOURCE_TYPE_WALL_TIME) {
136 // We currently only support the default time source, wall clock time. 136 // We currently only support the default time source, wall clock time.
137 return; 137 return;
138 } 138 }
139 139
140 has_profiler_data_ = true; 140 has_profiler_data_ = true;
141 profiler_event_cache_.set_profile_type(ProfilerEventProto::STARTUP_PROFILE); 141 profiler_event_cache_.set_profile_type(ProfilerEventProto::STARTUP_PROFILE);
142 profiler_event_cache_.set_time_source(ProfilerEventProto::WALL_CLOCK_TIME); 142 profiler_event_cache_.set_time_source(ProfilerEventProto::WALL_CLOCK_TIME);
143 WriteProfilerData(process_data, process_type, &profiler_event_cache_); 143 WriteProfilerData(process_data, process_type, &profiler_event_cache_);
144 } 144 }
OLDNEW
« no previous file with comments | « chrome/browser/metrics/omnibox_metrics_provider.cc ('k') | components/components_tests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698