OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 4 |
5 #include "dbus/dbus_statistics.h" | 5 #include "dbus/dbus_statistics.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 // Simple class for gathering DBus usage statistics. | 62 // Simple class for gathering DBus usage statistics. |
63 class DBusStatistics { | 63 class DBusStatistics { |
64 public: | 64 public: |
65 DBusStatistics() | 65 DBusStatistics() |
66 : start_time_(base::Time::Now()), | 66 : start_time_(base::Time::Now()), |
67 origin_thread_id_(base::PlatformThread::CurrentId()) { | 67 origin_thread_id_(base::PlatformThread::CurrentId()) { |
68 } | 68 } |
69 | 69 |
70 ~DBusStatistics() { | 70 ~DBusStatistics() { |
71 DCHECK_EQ(origin_thread_id_, base::PlatformThread::CurrentId()); | 71 DCHECK_EQ(origin_thread_id_, base::PlatformThread::CurrentId()); |
72 STLDeleteContainerPointers(stats_.begin(), stats_.end()); | 72 base::STLDeleteContainerPointers(stats_.begin(), stats_.end()); |
73 } | 73 } |
74 | 74 |
75 // Enum to specify which field in Stat to increment in AddStat | 75 // Enum to specify which field in Stat to increment in AddStat |
76 enum StatType { | 76 enum StatType { |
77 TYPE_SENT_METHOD_CALLS, | 77 TYPE_SENT_METHOD_CALLS, |
78 TYPE_RECEIVED_SIGNALS, | 78 TYPE_RECEIVED_SIGNALS, |
79 TYPE_SENT_BLOCKING_METHOD_CALLS | 79 TYPE_SENT_BLOCKING_METHOD_CALLS |
80 }; | 80 }; |
81 | 81 |
82 // Add a call to |method| for |interface|. See also MethodCall in message.h. | 82 // Add a call to |method| for |interface|. See also MethodCall in message.h. |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 *sent = stat->sent_method_calls; | 275 *sent = stat->sent_method_calls; |
276 *received = stat->received_signals; | 276 *received = stat->received_signals; |
277 *blocking = stat->sent_blocking_method_calls; | 277 *blocking = stat->sent_blocking_method_calls; |
278 return true; | 278 return true; |
279 } | 279 } |
280 | 280 |
281 } // namespace testing | 281 } // namespace testing |
282 | 282 |
283 } // namespace statistics | 283 } // namespace statistics |
284 } // namespace dbus | 284 } // namespace dbus |
OLD | NEW |