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 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ | 674 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ |
675 TRACE_EVENT_PHASE_ASYNC_END, category_group, name, id, \ | 675 TRACE_EVENT_PHASE_ASYNC_END, category_group, name, id, \ |
676 static_cast<int>(base::PlatformThread::CurrentId()), \ | 676 static_cast<int>(base::PlatformThread::CurrentId()), \ |
677 timestamp, TRACE_EVENT_FLAG_NONE) | 677 timestamp, TRACE_EVENT_FLAG_NONE) |
678 | 678 |
679 // NESTABLE_ASYNC_* APIs are used to describe an async operation, which can | 679 // NESTABLE_ASYNC_* APIs are used to describe an async operation, which can |
680 // be nested within a NESTABLE_ASYNC event and/or have inner NESTABLE_ASYNC | 680 // be nested within a NESTABLE_ASYNC event and/or have inner NESTABLE_ASYNC |
681 // events. | 681 // events. |
682 // - category and name strings must have application lifetime (statics or | 682 // - category and name strings must have application lifetime (statics or |
683 // literals). They may not include " chars. | 683 // literals). They may not include " chars. |
684 // - |id| is used to match the NESTABLE_ASYNC_BEGIN event with the | 684 // - A pair of NESTABLE_ASYNC_BEGIN event and NESTABLE_ASYNC_END event is |
685 // NESTABLE_ASYNC_END event. Events are considered to match if their | 685 // considered as a match if their category_group, name and id all match. |
686 // category_group, name and id values all match. |id| must either be a | 686 // - |id| must either be a pointer or an integer value up to 64 bits. |
687 // pointer or an integer value up to 64 bits. If it's a pointer, the bits | 687 // If it's a pointer, the bits will be xored with a hash of the process ID so |
688 // will be xored with a hash of the process ID so that the same pointer on two | 688 // that the same pointer on two different processes will not collide. |
689 // different processes will not collide. | 689 // - |id| is used to match a child NESTABLE_ASYNC event with its parent |
| 690 // NESTABLE_ASYNC event. Therefore, events in the same nested event tree must |
| 691 // be logged using the same id and category_group. |
690 // | 692 // |
691 // Unmatched NESTABLE_ASYNC_END event will be parsed as an instant event, | 693 // Unmatched NESTABLE_ASYNC_END event will be parsed as an event that starts |
692 // and unmatched NESTABLE_ASYNC_BEGIN event will be parsed as an event that | 694 // at the first NESTABLE_ASYNC event of that id, and unmatched |
693 // ends at the last NESTABLE_ASYNC_END event of that |id|. | 695 // NESTABLE_ASYNC_BEGIN event will be parsed as an event that ends at the last |
| 696 // NESTABLE_ASYNC event of that id. Corresponding warning messages for |
| 697 // unmatched events will be shown in the analysis view. |
694 | 698 |
695 // Records a single NESTABLE_ASYNC_BEGIN event called "name" immediately, with 2 | 699 // Records a single NESTABLE_ASYNC_BEGIN event called "name" immediately, with 2 |
696 // associated arguments. If the category is not enabled, then this does nothing. | 700 // associated arguments. If the category is not enabled, then this does nothing. |
697 #define TRACE_EVENT_NESTABLE_ASYNC_BEGIN2(category_group, name, id, arg1_name, \ | 701 #define TRACE_EVENT_NESTABLE_ASYNC_BEGIN2(category_group, name, id, arg1_name, \ |
698 arg1_val, arg2_name, arg2_val) \ | 702 arg1_val, arg2_name, arg2_val) \ |
699 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_BEGIN, \ | 703 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_BEGIN, \ |
700 category_group, name, id, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, \ | 704 category_group, name, id, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, \ |
701 arg2_name, arg2_val) | 705 arg2_name, arg2_val) |
702 // Records a single NESTABLE_ASYNC_END event called "name" immediately, with 2 | 706 // Records a single NESTABLE_ASYNC_END event called "name" immediately, with 2 |
703 // associated arguments. If the category is not enabled, then this does nothing. | 707 // associated arguments. If the category is not enabled, then this does nothing. |
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1622 const char* name_; | 1626 const char* name_; |
1623 IDType id_; | 1627 IDType id_; |
1624 | 1628 |
1625 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); | 1629 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); |
1626 }; | 1630 }; |
1627 | 1631 |
1628 } // namespace trace_event | 1632 } // namespace trace_event |
1629 } // namespace base | 1633 } // namespace base |
1630 | 1634 |
1631 #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_ | 1635 #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_ |
OLD | NEW |