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 #ifndef BASE_TRACE_EVENT_TRACE_EVENT_H_ | 5 #ifndef BASE_TRACE_EVENT_TRACE_EVENT_H_ |
6 #define BASE_TRACE_EVENT_TRACE_EVENT_H_ | 6 #define BASE_TRACE_EVENT_TRACE_EVENT_H_ |
7 | 7 |
8 // This header file defines implementation details of how the trace macros in | 8 // This header file defines implementation details of how the trace macros in |
9 // trace_event_common.h collect and store trace events. Anything not | 9 // trace_event_common.h collect and store trace events. Anything not |
10 // implementation-specific should go in trace_macros_common.h instead of here. | 10 // implementation-specific should go in trace_macros_common.h instead of here. |
(...skipping 27 matching lines...) Expand all Loading... |
38 // constant strings). These states are intended for a sampling profiler. | 38 // constant strings). These states are intended for a sampling profiler. |
39 // Implementation note: we store category and name together because we don't | 39 // Implementation note: we store category and name together because we don't |
40 // want the inconsistency/expense of storing two pointers. | 40 // want the inconsistency/expense of storing two pointers. |
41 // |thread_bucket| is [0..2] and is used to statically isolate samples in one | 41 // |thread_bucket| is [0..2] and is used to statically isolate samples in one |
42 // thread from others. | 42 // thread from others. |
43 #define TRACE_EVENT_SET_SAMPLING_STATE_FOR_BUCKET( \ | 43 #define TRACE_EVENT_SET_SAMPLING_STATE_FOR_BUCKET( \ |
44 bucket_number, category, name) \ | 44 bucket_number, category, name) \ |
45 trace_event_internal:: \ | 45 trace_event_internal:: \ |
46 TraceEventSamplingStateScope<bucket_number>::Set(category "\0" name) | 46 TraceEventSamplingStateScope<bucket_number>::Set(category "\0" name) |
47 | 47 |
| 48 // Sets a current sampling state of the given bucket. |
| 49 // |categoryAndName| doesn't need to be a constant string. |
| 50 // The format of the string is "category\0name". |
| 51 #define TRACE_EVENT_SET_NONCONST_SAMPLING_STATE_FOR_BUCKET(bucket_number, catego
ry_and_name) \ |
| 52 trace_event_internal:: \ |
| 53 TraceEventSamplingStateScope<bucket_number>::Set(category_and_name) |
| 54 |
48 // Returns a current sampling state of the given bucket. | 55 // Returns a current sampling state of the given bucket. |
49 #define TRACE_EVENT_GET_SAMPLING_STATE_FOR_BUCKET(bucket_number) \ | 56 #define TRACE_EVENT_GET_SAMPLING_STATE_FOR_BUCKET(bucket_number) \ |
50 trace_event_internal::TraceEventSamplingStateScope<bucket_number>::Current() | 57 trace_event_internal::TraceEventSamplingStateScope<bucket_number>::Current() |
51 | 58 |
52 // Creates a scope of a sampling state of the given bucket. | 59 // Creates a scope of a sampling state of the given bucket. |
53 // | 60 // |
54 // { // The sampling state is set within this scope. | 61 // { // The sampling state is set within this scope. |
55 // TRACE_EVENT_SAMPLING_STATE_SCOPE_FOR_BUCKET(0, "category", "name"); | 62 // TRACE_EVENT_SAMPLING_STATE_SCOPE_FOR_BUCKET(0, "category", "name"); |
56 // ...; | 63 // ...; |
57 // } | 64 // } |
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 const char* name_; | 863 const char* name_; |
857 IDType id_; | 864 IDType id_; |
858 | 865 |
859 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); | 866 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); |
860 }; | 867 }; |
861 | 868 |
862 } // namespace trace_event | 869 } // namespace trace_event |
863 } // namespace base | 870 } // namespace base |
864 | 871 |
865 #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_ | 872 #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_ |
OLD | NEW |