OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 #include "webrtc/base/event_tracer.h" | 10 #include "webrtc/base/event_tracer.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
151 // log events from a previous logging session (which may be days old). | 151 // log events from a previous logging session (which may be days old). |
152 trace_events_.clear(); | 152 trace_events_.clear(); |
153 } | 153 } |
154 // Enable event logging (fast-path). This should be disabled since starting | 154 // Enable event logging (fast-path). This should be disabled since starting |
155 // shouldn't be done twice. | 155 // shouldn't be done twice. |
156 RTC_CHECK_EQ(0, | 156 RTC_CHECK_EQ(0, |
157 rtc::AtomicOps::CompareAndSwap(&g_event_logging_active, 0, 1)); | 157 rtc::AtomicOps::CompareAndSwap(&g_event_logging_active, 0, 1)); |
158 | 158 |
159 // Finally start, everything should be set up now. | 159 // Finally start, everything should be set up now. |
160 logging_thread_.Start(); | 160 logging_thread_.Start(); |
161 TRACE_EVENT_INSTANT0("webrtc", "EventLogger::Start"); | |
tommi
2016/02/29 13:12:27
would TRACE_EVENT_BEGIN0 and TRACE_EVENT_END0 be m
pbos-webrtc
2016/02/29 13:23:43
I don't think it's particularly useful to have a b
| |
161 } | 162 } |
162 | 163 |
163 void Stop() { | 164 void Stop() { |
165 TRACE_EVENT_INSTANT0("webrtc", "EventLogger::Stop"); | |
164 // Try to stop. Abort if we're not currently logging. | 166 // Try to stop. Abort if we're not currently logging. |
165 if (rtc::AtomicOps::CompareAndSwap(&g_event_logging_active, 1, 0) == 0) | 167 if (rtc::AtomicOps::CompareAndSwap(&g_event_logging_active, 1, 0) == 0) |
166 return; | 168 return; |
167 | 169 |
168 // Wake up logging thread to finish writing. | 170 // Wake up logging thread to finish writing. |
169 shutdown_event_.Set(); | 171 shutdown_event_.Set(); |
170 // Join the logging thread. | 172 // Join the logging thread. |
171 logging_thread_.Stop(); | 173 logging_thread_.Stop(); |
172 } | 174 } |
173 | 175 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
261 RTC_DCHECK(old_logger); | 263 RTC_DCHECK(old_logger); |
262 RTC_CHECK(rtc::AtomicOps::CompareAndSwapPtr( | 264 RTC_CHECK(rtc::AtomicOps::CompareAndSwapPtr( |
263 &g_event_logger, old_logger, | 265 &g_event_logger, old_logger, |
264 static_cast<EventLogger*>(nullptr)) == old_logger); | 266 static_cast<EventLogger*>(nullptr)) == old_logger); |
265 delete old_logger; | 267 delete old_logger; |
266 webrtc::SetupEventTracer(nullptr, nullptr); | 268 webrtc::SetupEventTracer(nullptr, nullptr); |
267 } | 269 } |
268 | 270 |
269 } // namespace tracing | 271 } // namespace tracing |
270 } // namespace rtc | 272 } // namespace rtc |
OLD | NEW |