OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 | 10 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 #define BWE_TEST_LOGGING_LABEL(figure, x_label, y_label, num_flows) | 122 #define BWE_TEST_LOGGING_LABEL(figure, x_label, y_label, num_flows) |
123 | 123 |
124 #else // BWE_TEST_LOGGING_COMPILE_TIME_ENABLE | 124 #else // BWE_TEST_LOGGING_COMPILE_TIME_ENABLE |
125 | 125 |
126 #include <map> | 126 #include <map> |
127 #include <memory> | 127 #include <memory> |
128 #include <stack> | 128 #include <stack> |
129 #include <string> | 129 #include <string> |
130 | 130 |
131 #include "webrtc/base/constructormagic.h" | 131 #include "webrtc/base/constructormagic.h" |
| 132 #include "webrtc/base/criticalsection.h" |
132 #include "webrtc/common_types.h" | 133 #include "webrtc/common_types.h" |
133 | 134 |
134 #define BWE_TEST_LOGGING_GLOBAL_CONTEXT(name) \ | 135 #define BWE_TEST_LOGGING_GLOBAL_CONTEXT(name) \ |
135 do { \ | 136 do { \ |
136 webrtc::testing::bwe::Logging::GetInstance()->SetGlobalContext(name); \ | 137 webrtc::testing::bwe::Logging::GetInstance()->SetGlobalContext(name); \ |
137 } while (0) | 138 } while (0) |
138 | 139 |
139 #define BWE_TEST_LOGGING_GLOBAL_ENABLE(enabled) \ | 140 #define BWE_TEST_LOGGING_GLOBAL_ENABLE(enabled) \ |
140 do { \ | 141 do { \ |
141 webrtc::testing::bwe::Logging::GetInstance()->SetGlobalEnable(enabled); \ | 142 webrtc::testing::bwe::Logging::GetInstance()->SetGlobalEnable(enabled); \ |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 } while (0) | 248 } while (0) |
248 | 249 |
249 #define BWE_TEST_LOGGING_LABEL(figure, title, y_label, num_flows) \ | 250 #define BWE_TEST_LOGGING_LABEL(figure, title, y_label, num_flows) \ |
250 do { \ | 251 do { \ |
251 BWE_TEST_LOGGING_CONTEXT(title); \ | 252 BWE_TEST_LOGGING_CONTEXT(title); \ |
252 webrtc::testing::bwe::Logging::GetInstance()->PlotLabel( \ | 253 webrtc::testing::bwe::Logging::GetInstance()->PlotLabel( \ |
253 figure, title, y_label, num_flows); \ | 254 figure, title, y_label, num_flows); \ |
254 } while (0) | 255 } while (0) |
255 | 256 |
256 namespace webrtc { | 257 namespace webrtc { |
257 | |
258 class CriticalSectionWrapper; | |
259 | |
260 namespace testing { | 258 namespace testing { |
261 namespace bwe { | 259 namespace bwe { |
262 | 260 |
263 class Logging { | 261 class Logging { |
264 public: | 262 public: |
265 class Context { | 263 class Context { |
266 public: | 264 public: |
267 Context(uint32_t name, int64_t timestamp_ms, bool enabled); | 265 Context(uint32_t name, int64_t timestamp_ms, bool enabled); |
268 Context(const std::string& name, int64_t timestamp_ms, bool enabled); | 266 Context(const std::string& name, int64_t timestamp_ms, bool enabled); |
269 Context(const char* name, int64_t timestamp_ms, bool enabled); | 267 Context(const char* name, int64_t timestamp_ms, bool enabled); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 std::stack<State> stack; | 331 std::stack<State> stack; |
334 }; | 332 }; |
335 typedef std::map<uint32_t, ThreadState> ThreadMap; | 333 typedef std::map<uint32_t, ThreadState> ThreadMap; |
336 | 334 |
337 Logging(); | 335 Logging(); |
338 void PushState(const std::string& append_to_tag, int64_t timestamp_ms, | 336 void PushState(const std::string& append_to_tag, int64_t timestamp_ms, |
339 bool enabled); | 337 bool enabled); |
340 void PopState(); | 338 void PopState(); |
341 | 339 |
342 static Logging g_Logging; | 340 static Logging g_Logging; |
343 std::unique_ptr<CriticalSectionWrapper> crit_sect_; | 341 rtc::CriticalSection crit_sect_; |
344 ThreadMap thread_map_; | 342 ThreadMap thread_map_; |
345 | 343 |
346 RTC_DISALLOW_COPY_AND_ASSIGN(Logging); | 344 RTC_DISALLOW_COPY_AND_ASSIGN(Logging); |
347 }; | 345 }; |
348 } // namespace bwe | 346 } // namespace bwe |
349 } // namespace testing | 347 } // namespace testing |
350 } // namespace webrtc | 348 } // namespace webrtc |
351 | 349 |
352 #endif // BWE_TEST_LOGGING_COMPILE_TIME_ENABLE | 350 #endif // BWE_TEST_LOGGING_COMPILE_TIME_ENABLE |
353 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_BWE_TEST_LOGGING_H_ | 351 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_BWE_TEST_LOGGING_H_ |
OLD | NEW |