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

Side by Side Diff: content/browser/tracing/tracing_controller_impl.cc

Issue 1826973004: tracing: Add the TimeTicks clock source as trace metadata (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « chrome/common/trace_event_args_whitelist.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #include "content/browser/tracing/tracing_controller_impl.h" 4 #include "content/browser/tracing/tracing_controller_impl.h"
5 5
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/cpu.h" 7 #include "base/cpu.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/guid.h" 9 #include "base/guid.h"
10 #include "base/json/string_escape.h" 10 #include "base/json/string_escape.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 return "None"; 83 return "None";
84 case net::NetworkChangeNotifier::CONNECTION_BLUETOOTH: 84 case net::NetworkChangeNotifier::CONNECTION_BLUETOOTH:
85 return "Bluetooth"; 85 return "Bluetooth";
86 case net::NetworkChangeNotifier::CONNECTION_UNKNOWN: 86 case net::NetworkChangeNotifier::CONNECTION_UNKNOWN:
87 default: 87 default:
88 break; 88 break;
89 } 89 }
90 return "Unknown"; 90 return "Unknown";
91 } 91 }
92 92
93 std::string GetClockString() {
94 switch (base::TimeTicks::GetClock()) {
95 case base::TimeTicks::Clock::LINUX_CLOCK_MONOTONIC:
96 return "LINUX_CLOCK_MONOTONIC";
97 case base::TimeTicks::Clock::IOS_CF_ABSOLUTE_TIME_MINUS_KERN_BOOTTIME:
98 return "IOS_CF_ABSOLUTE_TIME_MINUS_KERN_BOOTTIME";
99 case base::TimeTicks::Clock::MAC_MACH_ABSOLUTE_TIME:
100 return "MAC_MACH_ABSOLUTE_TIME";
101 case base::TimeTicks::Clock::WIN_QPC:
102 return "WIN_QPC";
103 case base::TimeTicks::Clock::WIN_ROLLOVER_PROTECTED_TIME_GET_TIME:
104 return "WIN_ROLLOVER_PROTECTED_TIME_GET_TIME";
105 }
106
107 NOTREACHED();
108 return std::string();
109 }
110
93 scoped_ptr<base::DictionaryValue> GenerateTracingMetadataDict() { 111 scoped_ptr<base::DictionaryValue> GenerateTracingMetadataDict() {
94 scoped_ptr<base::DictionaryValue> metadata_dict(new base::DictionaryValue()); 112 scoped_ptr<base::DictionaryValue> metadata_dict(new base::DictionaryValue());
95 113
96 metadata_dict->SetString("network-type", GetNetworkTypeString()); 114 metadata_dict->SetString("network-type", GetNetworkTypeString());
97 metadata_dict->SetString("product-version", GetContentClient()->GetProduct()); 115 metadata_dict->SetString("product-version", GetContentClient()->GetProduct());
98 metadata_dict->SetString("user-agent", GetContentClient()->GetUserAgent()); 116 metadata_dict->SetString("user-agent", GetContentClient()->GetUserAgent());
99 117
100 // OS 118 // OS
101 metadata_dict->SetString("os-name", base::SysInfo::OperatingSystemName()); 119 metadata_dict->SetString("os-name", base::SysInfo::OperatingSystemName());
102 metadata_dict->SetString("os-version", 120 metadata_dict->SetString("os-version",
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 #elif defined(OS_POSIX) 156 #elif defined(OS_POSIX)
139 metadata_dict->SetString("gpu-gl-vendor", gpu_info.gl_vendor); 157 metadata_dict->SetString("gpu-gl-vendor", gpu_info.gl_vendor);
140 metadata_dict->SetString("gpu-gl-renderer", gpu_info.gl_renderer); 158 metadata_dict->SetString("gpu-gl-renderer", gpu_info.gl_renderer);
141 #endif 159 #endif
142 160
143 scoped_ptr<TracingDelegate> delegate( 161 scoped_ptr<TracingDelegate> delegate(
144 GetContentClient()->browser()->GetTracingDelegate()); 162 GetContentClient()->browser()->GetTracingDelegate());
145 if (delegate) 163 if (delegate)
146 delegate->GenerateMetadataDict(metadata_dict.get()); 164 delegate->GenerateMetadataDict(metadata_dict.get());
147 165
148 // Highres ticks. 166 metadata_dict->SetString("clock-domain", GetClockString());
149 metadata_dict->SetBoolean("highres-ticks", 167 metadata_dict->SetBoolean("highres-ticks",
150 base::TimeTicks::IsHighResolution()); 168 base::TimeTicks::IsHighResolution());
151 169
152 return metadata_dict; 170 return metadata_dict;
153 } 171 }
154 172
155 } // namespace 173 } // namespace
156 174
157 TracingController* TracingController::GetInstance() { 175 TracingController* TracingController::GetInstance() {
158 return TracingControllerImpl::GetInstance(); 176 return TracingControllerImpl::GetInstance();
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 const bool global_success = failed_memory_dump_count_ == 0; 1025 const bool global_success = failed_memory_dump_count_ == 0;
1008 if (!pending_memory_dump_callback_.is_null()) { 1026 if (!pending_memory_dump_callback_.is_null()) {
1009 pending_memory_dump_callback_.Run(pending_memory_dump_guid_, 1027 pending_memory_dump_callback_.Run(pending_memory_dump_guid_,
1010 global_success); 1028 global_success);
1011 pending_memory_dump_callback_.Reset(); 1029 pending_memory_dump_callback_.Reset();
1012 } 1030 }
1013 pending_memory_dump_guid_ = 0; 1031 pending_memory_dump_guid_ = 0;
1014 } 1032 }
1015 1033
1016 } // namespace content 1034 } // namespace content
OLDNEW
« no previous file with comments | « chrome/common/trace_event_args_whitelist.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698