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 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 arg1_name, arg1_val, arg2_name, arg2_val) | 627 arg1_name, arg1_val, arg2_name, arg2_val) |
628 | 628 |
629 // Similar to TRACE_EVENT_ASYNC_ENDx but with a custom |at| timestamp provided. | 629 // Similar to TRACE_EVENT_ASYNC_ENDx but with a custom |at| timestamp provided. |
630 #define TRACE_EVENT_ASYNC_END_WITH_TIMESTAMP0(category_group, \ | 630 #define TRACE_EVENT_ASYNC_END_WITH_TIMESTAMP0(category_group, \ |
631 name, id, timestamp) \ | 631 name, id, timestamp) \ |
632 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ | 632 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ |
633 TRACE_EVENT_PHASE_ASYNC_END, category_group, name, id, \ | 633 TRACE_EVENT_PHASE_ASYNC_END, category_group, name, id, \ |
634 static_cast<int>(base::PlatformThread::CurrentId()), \ | 634 static_cast<int>(base::PlatformThread::CurrentId()), \ |
635 timestamp, TRACE_EVENT_FLAG_NONE) | 635 timestamp, TRACE_EVENT_FLAG_NONE) |
636 | 636 |
| 637 |
| 638 // Records a single NET_LOG_BEGIN event called "name" immediately, with 1 |
| 639 // associated argument. If the category is not enabled, then this |
| 640 // does nothing. |
| 641 // - category and name strings must have application lifetime (statics or |
| 642 // literals). They may not include " chars. |
| 643 // - |id| is used to match the NET_LOG_BEGIN event with the NET_LOG_END event. |
| 644 // Events are considered to match if their category_group, name and id values |
| 645 // all match. |id| must either be a pointer or an integer value up to 64 bits. |
| 646 // If it's a pointer, the bits will be xored with a hash of the process ID so |
| 647 // that the same pointer on two different processes will not collide. |
| 648 // NET_LOG_ events are supposed to be used for logging NetLog events only. |
| 649 |
| 650 #define TRACE_EVENT_NET_LOG_BEGIN(category_group, name, id, arg1_name, \ |
| 651 arg1_val) \ |
| 652 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NET_LOG_BEGIN, \ |
| 653 category_group, name, id, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val) |
| 654 // Records a single NET_LOG_END event for "name" immediately. If the category |
| 655 // is not enabled, then this does nothing. |
| 656 #define TRACE_EVENT_NET_LOG_END(category_group, name, id, arg1_name, arg1_val) \ |
| 657 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NET_LOG_END, \ |
| 658 category_group, name, id, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val) |
| 659 // Records a single NET_LOG_INSTANT event for "name" immediately. |
| 660 // If the category is not enabled, then this does nothing. |
| 661 #define TRACE_EVENT_NET_LOG_INSTANT(category_group, name, id, arg1_name, arg1_va
l) \ |
| 662 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NET_LOG_INSTANT, \ |
| 663 category_group, name, id, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val) |
| 664 |
637 // Records a single FLOW_BEGIN event called "name" immediately, with 0, 1 or 2 | 665 // Records a single FLOW_BEGIN event called "name" immediately, with 0, 1 or 2 |
638 // associated arguments. If the category is not enabled, then this | 666 // associated arguments. If the category is not enabled, then this |
639 // does nothing. | 667 // does nothing. |
640 // - category and name strings must have application lifetime (statics or | 668 // - category and name strings must have application lifetime (statics or |
641 // literals). They may not include " chars. | 669 // literals). They may not include " chars. |
642 // - |id| is used to match the FLOW_BEGIN event with the FLOW_END event. FLOW | 670 // - |id| is used to match the FLOW_BEGIN event with the FLOW_END event. FLOW |
643 // events are considered to match if their category_group, name and id values | 671 // events are considered to match if their category_group, name and id values |
644 // all match. |id| must either be a pointer or an integer value up to 64 bits. | 672 // all match. |id| must either be a pointer or an integer value up to 64 bits. |
645 // If it's a pointer, the bits will be xored with a hash of the process ID so | 673 // If it's a pointer, the bits will be xored with a hash of the process ID so |
646 // that the same pointer on two different processes will not collide. | 674 // that the same pointer on two different processes will not collide. |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 #define TRACE_EVENT_PHASE_ASYNC_END ('F') | 993 #define TRACE_EVENT_PHASE_ASYNC_END ('F') |
966 #define TRACE_EVENT_PHASE_FLOW_BEGIN ('s') | 994 #define TRACE_EVENT_PHASE_FLOW_BEGIN ('s') |
967 #define TRACE_EVENT_PHASE_FLOW_STEP ('t') | 995 #define TRACE_EVENT_PHASE_FLOW_STEP ('t') |
968 #define TRACE_EVENT_PHASE_FLOW_END ('f') | 996 #define TRACE_EVENT_PHASE_FLOW_END ('f') |
969 #define TRACE_EVENT_PHASE_METADATA ('M') | 997 #define TRACE_EVENT_PHASE_METADATA ('M') |
970 #define TRACE_EVENT_PHASE_COUNTER ('C') | 998 #define TRACE_EVENT_PHASE_COUNTER ('C') |
971 #define TRACE_EVENT_PHASE_SAMPLE ('P') | 999 #define TRACE_EVENT_PHASE_SAMPLE ('P') |
972 #define TRACE_EVENT_PHASE_CREATE_OBJECT ('N') | 1000 #define TRACE_EVENT_PHASE_CREATE_OBJECT ('N') |
973 #define TRACE_EVENT_PHASE_SNAPSHOT_OBJECT ('O') | 1001 #define TRACE_EVENT_PHASE_SNAPSHOT_OBJECT ('O') |
974 #define TRACE_EVENT_PHASE_DELETE_OBJECT ('D') | 1002 #define TRACE_EVENT_PHASE_DELETE_OBJECT ('D') |
| 1003 #define TRACE_EVENT_PHASE_NET_LOG_BEGIN ('b') |
| 1004 #define TRACE_EVENT_PHASE_NET_LOG_END ('e') |
| 1005 #define TRACE_EVENT_PHASE_NET_LOG_INSTANT ('i') |
975 | 1006 |
976 // Flags for changing the behavior of TRACE_EVENT_API_ADD_TRACE_EVENT. | 1007 // Flags for changing the behavior of TRACE_EVENT_API_ADD_TRACE_EVENT. |
977 #define TRACE_EVENT_FLAG_NONE (static_cast<unsigned char>(0)) | 1008 #define TRACE_EVENT_FLAG_NONE (static_cast<unsigned char>(0)) |
978 #define TRACE_EVENT_FLAG_COPY (static_cast<unsigned char>(1 << 0)) | 1009 #define TRACE_EVENT_FLAG_COPY (static_cast<unsigned char>(1 << 0)) |
979 #define TRACE_EVENT_FLAG_HAS_ID (static_cast<unsigned char>(1 << 1)) | 1010 #define TRACE_EVENT_FLAG_HAS_ID (static_cast<unsigned char>(1 << 1)) |
980 #define TRACE_EVENT_FLAG_MANGLE_ID (static_cast<unsigned char>(1 << 2)) | 1011 #define TRACE_EVENT_FLAG_MANGLE_ID (static_cast<unsigned char>(1 << 2)) |
981 #define TRACE_EVENT_FLAG_SCOPE_OFFSET (static_cast<unsigned char>(1 << 3)) | 1012 #define TRACE_EVENT_FLAG_SCOPE_OFFSET (static_cast<unsigned char>(1 << 3)) |
982 | 1013 |
983 #define TRACE_EVENT_FLAG_SCOPE_MASK (static_cast<unsigned char>( \ | 1014 #define TRACE_EVENT_FLAG_SCOPE_MASK (static_cast<unsigned char>( \ |
984 TRACE_EVENT_FLAG_SCOPE_OFFSET | (TRACE_EVENT_FLAG_SCOPE_OFFSET << 1))) | 1015 TRACE_EVENT_FLAG_SCOPE_OFFSET | (TRACE_EVENT_FLAG_SCOPE_OFFSET << 1))) |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1526 const char* name_; | 1557 const char* name_; |
1527 IDType id_; | 1558 IDType id_; |
1528 | 1559 |
1529 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); | 1560 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); |
1530 }; | 1561 }; |
1531 | 1562 |
1532 } // namespace debug | 1563 } // namespace debug |
1533 } // namespace base | 1564 } // namespace base |
1534 | 1565 |
1535 #endif /* BASE_DEBUG_TRACE_EVENT_H_ */ | 1566 #endif /* BASE_DEBUG_TRACE_EVENT_H_ */ |
OLD | NEW |