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 // This header file defines the set of trace_event macros without specifying | 5 // This header file defines the set of trace_event macros without specifying |
6 // how the events actually get collected and stored. If you need to expose trace | 6 // how the events actually get collected and stored. If you need to expose trace |
7 // events to some other universe, you can copy-and-paste this file as well as | 7 // events to some other universe, you can copy-and-paste this file as well as |
8 // trace_event.h, modifying the macros contained there as necessary for the | 8 // trace_event.h, modifying the macros contained there as necessary for the |
9 // target platform. The end result is that multiple libraries can funnel events | 9 // target platform. The end result is that multiple libraries can funnel events |
10 // through to a shared trace event collector. | 10 // through to a shared trace event collector. |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // Converting a large data type to a string can be costly. To help with this, | 137 // Converting a large data type to a string can be costly. To help with this, |
138 // the trace framework provides an interface ConvertableToTraceFormat. If you | 138 // the trace framework provides an interface ConvertableToTraceFormat. If you |
139 // inherit from it and implement the AppendAsTraceFormat method the trace | 139 // inherit from it and implement the AppendAsTraceFormat method the trace |
140 // framework will call back to your object to convert a trace output time. This | 140 // framework will call back to your object to convert a trace output time. This |
141 // means, if the category for the event is disabled, the conversion will not | 141 // means, if the category for the event is disabled, the conversion will not |
142 // happen. | 142 // happen. |
143 // | 143 // |
144 // class MyData : public base::trace_event::ConvertableToTraceFormat { | 144 // class MyData : public base::trace_event::ConvertableToTraceFormat { |
145 // public: | 145 // public: |
146 // MyData() {} | 146 // MyData() {} |
147 // virtual void AppendAsTraceFormat(std::string* out) const override { | 147 // void AppendAsTraceFormat(std::string* out) const override { |
148 // out->append("{\"foo\":1}"); | 148 // out->append("{\"foo\":1}"); |
149 // } | 149 // } |
150 // private: | 150 // private: |
151 // virtual ~MyData() {} | 151 // ~MyData() override {} |
152 // DISALLOW_COPY_AND_ASSIGN(MyData); | 152 // DISALLOW_COPY_AND_ASSIGN(MyData); |
153 // }; | 153 // }; |
154 // | 154 // |
155 // TRACE_EVENT1("foo", "bar", "data", | 155 // TRACE_EVENT1("foo", "bar", "data", |
156 // scoped_refptr<ConvertableToTraceFormat>(new MyData())); | 156 // scoped_refptr<ConvertableToTraceFormat>(new MyData())); |
157 // | 157 // |
158 // The trace framework will take ownership if the passed pointer and it will | 158 // The trace framework will take ownership if the passed pointer and it will |
159 // be free'd when the trace buffer is flushed. | 159 // be free'd when the trace buffer is flushed. |
160 // | 160 // |
161 // Note, we only do the conversion when the buffer is flushed, so the provided | 161 // Note, we only do the conversion when the buffer is flushed, so the provided |
(...skipping 1465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1627 const char* name_; | 1627 const char* name_; |
1628 IDType id_; | 1628 IDType id_; |
1629 | 1629 |
1630 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); | 1630 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); |
1631 }; | 1631 }; |
1632 | 1632 |
1633 } // namespace trace_event | 1633 } // namespace trace_event |
1634 } // namespace base | 1634 } // namespace base |
1635 | 1635 |
1636 #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_ | 1636 #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_ |
OLD | NEW |