OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 bool Clear(); | 127 bool Clear(); |
128 | 128 |
129 static Profiler* Instance(); | 129 static Profiler* Instance(); |
130 private: | 130 private: |
131 Profiler(); | 131 Profiler(); |
132 | 132 |
133 typedef std::map<std::string, ProfilerEvent> EventMap; | 133 typedef std::map<std::string, ProfilerEvent> EventMap; |
134 EventMap events_; | 134 EventMap events_; |
135 mutable SharedExclusiveLock lock_; | 135 mutable SharedExclusiveLock lock_; |
136 | 136 |
137 DISALLOW_COPY_AND_ASSIGN(Profiler); | 137 RTC_DISALLOW_COPY_AND_ASSIGN(Profiler); |
138 }; | 138 }; |
139 | 139 |
140 // Starts an event on construction and stops it on destruction. | 140 // Starts an event on construction and stops it on destruction. |
141 // Used by PROFILE macro. | 141 // Used by PROFILE macro. |
142 class ProfilerScope { | 142 class ProfilerScope { |
143 public: | 143 public: |
144 explicit ProfilerScope(const std::string& event_name) | 144 explicit ProfilerScope(const std::string& event_name) |
145 : event_name_(event_name) { | 145 : event_name_(event_name) { |
146 Profiler::Instance()->StartEvent(event_name_); | 146 Profiler::Instance()->StartEvent(event_name_); |
147 } | 147 } |
148 ~ProfilerScope() { | 148 ~ProfilerScope() { |
149 Profiler::Instance()->StopEvent(event_name_); | 149 Profiler::Instance()->StopEvent(event_name_); |
150 } | 150 } |
151 private: | 151 private: |
152 std::string event_name_; | 152 std::string event_name_; |
153 | 153 |
154 DISALLOW_COPY_AND_ASSIGN(ProfilerScope); | 154 RTC_DISALLOW_COPY_AND_ASSIGN(ProfilerScope); |
155 }; | 155 }; |
156 | 156 |
157 std::ostream& operator<<(std::ostream& stream, | 157 std::ostream& operator<<(std::ostream& stream, |
158 const ProfilerEvent& profiler_event); | 158 const ProfilerEvent& profiler_event); |
159 | 159 |
160 } // namespace rtc | 160 } // namespace rtc |
161 | 161 |
162 #endif // WEBRTC_BASE_PROFILER_H_ | 162 #endif // WEBRTC_BASE_PROFILER_H_ |
OLD | NEW |