OLD | NEW |
---|---|
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/json/string_escape.h" | 9 #include "base/json/string_escape.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 | 43 |
44 namespace { | 44 namespace { |
45 | 45 |
46 base::LazyInstance<TracingControllerImpl>::Leaky g_controller = | 46 base::LazyInstance<TracingControllerImpl>::Leaky g_controller = |
47 LAZY_INSTANCE_INITIALIZER; | 47 LAZY_INSTANCE_INITIALIZER; |
48 | 48 |
49 const char kChromeTracingAgentName[] = "chrome"; | 49 const char kChromeTracingAgentName[] = "chrome"; |
50 const char kETWTracingAgentName[] = "etw"; | 50 const char kETWTracingAgentName[] = "etw"; |
51 const char kChromeTraceLabel[] = "traceEvents"; | 51 const char kChromeTraceLabel[] = "traceEvents"; |
52 | 52 |
53 const int kIssueClockSyncTimeout = 30; | 53 const int kIssueClockSyncTimeoutSeconds = 30; |
54 | 54 |
55 std::string GetNetworkTypeString() { | 55 std::string GetNetworkTypeString() { |
56 switch (net::NetworkChangeNotifier::GetConnectionType()) { | 56 switch (net::NetworkChangeNotifier::GetConnectionType()) { |
57 case net::NetworkChangeNotifier::CONNECTION_ETHERNET: | 57 case net::NetworkChangeNotifier::CONNECTION_ETHERNET: |
58 return "Ethernet"; | 58 return "Ethernet"; |
59 case net::NetworkChangeNotifier::CONNECTION_WIFI: | 59 case net::NetworkChangeNotifier::CONNECTION_WIFI: |
60 return "WiFi"; | 60 return "WiFi"; |
61 case net::NetworkChangeNotifier::CONNECTION_2G: | 61 case net::NetworkChangeNotifier::CONNECTION_2G: |
62 return "2G"; | 62 return "2G"; |
63 case net::NetworkChangeNotifier::CONNECTION_3G: | 63 case net::NetworkChangeNotifier::CONNECTION_3G: |
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
961 pending_clock_sync_ack_count_++; | 961 pending_clock_sync_ack_count_++; |
962 } | 962 } |
963 } | 963 } |
964 | 964 |
965 // If no clock sync is needed, stop tracing right away. Otherwise, schedule | 965 // If no clock sync is needed, stop tracing right away. Otherwise, schedule |
966 // to stop tracing after timeout. | 966 // to stop tracing after timeout. |
967 if (pending_clock_sync_ack_count_ == 0) { | 967 if (pending_clock_sync_ack_count_ == 0) { |
968 StopTracingAfterClockSync(); | 968 StopTracingAfterClockSync(); |
969 } else { | 969 } else { |
970 clock_sync_timer_.Start( | 970 clock_sync_timer_.Start( |
971 FROM_HERE, | 971 FROM_HERE, base::TimeDelta::FromSeconds(kIssueClockSyncTimeoutSeconds), |
charliea (OOO until 10-5)
2016/01/26 14:47:20
(I also ran git cl format, which caused the format
| |
972 base::TimeDelta::FromSeconds(kIssueClockSyncTimeout), | 972 this, &TracingControllerImpl::StopTracingAfterClockSync); |
973 this, | |
974 &TracingControllerImpl::StopTracingAfterClockSync); | |
975 } | 973 } |
976 } | 974 } |
977 | 975 |
978 void TracingControllerImpl::OnClockSyncMarkerRecordedByAgent( | 976 void TracingControllerImpl::OnClockSyncMarkerRecordedByAgent( |
979 int sync_id, | 977 int sync_id, |
980 const base::TimeTicks& issue_ts, | 978 const base::TimeTicks& issue_ts, |
981 const base::TimeTicks& issue_end_ts) { | 979 const base::TimeTicks& issue_end_ts) { |
982 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 980 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
983 | 981 |
984 TRACE_EVENT_CLOCK_SYNC_ISSUER(sync_id, issue_ts, issue_end_ts); | 982 TRACE_EVENT_CLOCK_SYNC_ISSUER(sync_id, issue_ts, issue_end_ts); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1123 is_monitoring_ = is_monitoring; | 1121 is_monitoring_ = is_monitoring; |
1124 #if !defined(OS_ANDROID) | 1122 #if !defined(OS_ANDROID) |
1125 for (std::set<TracingUI*>::iterator it = tracing_uis_.begin(); | 1123 for (std::set<TracingUI*>::iterator it = tracing_uis_.begin(); |
1126 it != tracing_uis_.end(); it++) { | 1124 it != tracing_uis_.end(); it++) { |
1127 (*it)->OnMonitoringStateChanged(is_monitoring); | 1125 (*it)->OnMonitoringStateChanged(is_monitoring); |
1128 } | 1126 } |
1129 #endif | 1127 #endif |
1130 } | 1128 } |
1131 | 1129 |
1132 } // namespace content | 1130 } // namespace content |
OLD | NEW |