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 | 10 |
11 #include "webrtc/system_wrappers/source/trace_impl.h" | 11 #include "webrtc/system_wrappers/source/trace_impl.h" |
12 | 12 |
13 #include <assert.h> | 13 #include <assert.h> |
14 #include <stdarg.h> | 14 #include <stdarg.h> |
15 #include <stdio.h> | 15 #include <stdio.h> |
16 #include <string.h> | 16 #include <string.h> |
17 | 17 |
18 #include "webrtc/base/atomicops.h" | 18 #include "webrtc/base/atomicops.h" |
| 19 #include "webrtc/base/platform_thread.h" |
19 #ifdef _WIN32 | 20 #ifdef _WIN32 |
20 #include "webrtc/system_wrappers/source/trace_win.h" | 21 #include "webrtc/system_wrappers/source/trace_win.h" |
21 #else | 22 #else |
22 #include "webrtc/system_wrappers/source/trace_posix.h" | 23 #include "webrtc/system_wrappers/source/trace_posix.h" |
23 #endif // _WIN32 | 24 #endif // _WIN32 |
24 | 25 |
25 #define KEY_LEN_CHARS 31 | 26 #define KEY_LEN_CHARS 31 |
26 | 27 |
27 #ifdef _WIN32 | 28 #ifdef _WIN32 |
28 #pragma warning(disable:4355) | 29 #pragma warning(disable:4355) |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 file_count_text_(0), | 70 file_count_text_(0), |
70 trace_file_(FileWrapper::Create()) { | 71 trace_file_(FileWrapper::Create()) { |
71 } | 72 } |
72 | 73 |
73 TraceImpl::~TraceImpl() { | 74 TraceImpl::~TraceImpl() { |
74 trace_file_->Flush(); | 75 trace_file_->Flush(); |
75 trace_file_->CloseFile(); | 76 trace_file_->CloseFile(); |
76 } | 77 } |
77 | 78 |
78 int32_t TraceImpl::AddThreadId(char* trace_message) const { | 79 int32_t TraceImpl::AddThreadId(char* trace_message) const { |
79 uint32_t thread_id = ThreadWrapper::GetThreadId(); | 80 uint32_t thread_id = rtc::CurrentThreadId(); |
80 // Messages is 12 characters. | 81 // Messages is 12 characters. |
81 return sprintf(trace_message, "%10u; ", thread_id); | 82 return sprintf(trace_message, "%10u; ", thread_id); |
82 } | 83 } |
83 | 84 |
84 int32_t TraceImpl::AddLevel(char* sz_message, const TraceLevel level) const { | 85 int32_t TraceImpl::AddLevel(char* sz_message, const TraceLevel level) const { |
85 const int kMessageLength = 12; | 86 const int kMessageLength = 12; |
86 switch (level) { | 87 switch (level) { |
87 case kTraceTerseInfo: | 88 case kTraceTerseInfo: |
88 // Add the appropriate amount of whitespace. | 89 // Add the appropriate amount of whitespace. |
89 memset(sz_message, ' ', kMessageLength); | 90 memset(sz_message, ' ', kMessageLength); |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 va_end(args); | 596 va_end(args); |
596 buff = temp_buff; | 597 buff = temp_buff; |
597 } | 598 } |
598 trace->AddImpl(level, module, id, buff); | 599 trace->AddImpl(level, module, id, buff); |
599 } | 600 } |
600 ReturnTrace(); | 601 ReturnTrace(); |
601 } | 602 } |
602 } | 603 } |
603 | 604 |
604 } // namespace webrtc | 605 } // namespace webrtc |
OLD | NEW |