| 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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 #define TRACE_EVENT_COPY_BEGIN_WITH_ID_TID_AND_TIMESTAMP0( \ | 393 #define TRACE_EVENT_COPY_BEGIN_WITH_ID_TID_AND_TIMESTAMP0( \ |
| 394 category_group, name, id, thread_id, timestamp) \ | 394 category_group, name, id, thread_id, timestamp) \ |
| 395 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ | 395 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ |
| 396 TRACE_EVENT_PHASE_ASYNC_BEGIN, category_group, name, id, thread_id, \ | 396 TRACE_EVENT_PHASE_ASYNC_BEGIN, category_group, name, id, thread_id, \ |
| 397 timestamp, TRACE_EVENT_FLAG_COPY) | 397 timestamp, TRACE_EVENT_FLAG_COPY) |
| 398 #define TRACE_EVENT_COPY_BEGIN_WITH_ID_TID_AND_TIMESTAMP1( \ | 398 #define TRACE_EVENT_COPY_BEGIN_WITH_ID_TID_AND_TIMESTAMP1( \ |
| 399 category_group, name, id, thread_id, timestamp, arg1_name, arg1_val) \ | 399 category_group, name, id, thread_id, timestamp, arg1_name, arg1_val) \ |
| 400 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ | 400 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ |
| 401 TRACE_EVENT_PHASE_ASYNC_BEGIN, category_group, name, id, thread_id, \ | 401 TRACE_EVENT_PHASE_ASYNC_BEGIN, category_group, name, id, thread_id, \ |
| 402 timestamp, TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val) | 402 timestamp, TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val) |
| 403 #define TRACE_EVENT_COPY_BEGIN_WITH_ID_TID_AND_TIMESTAMP2( \ |
| 404 category_group, name, id, thread_id, timestamp, arg1_name, arg1_val, \ |
| 405 arg2_name, arg2_val) \ |
| 406 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ |
| 407 TRACE_EVENT_PHASE_ASYNC_BEGIN, category_group, name, id, thread_id, \ |
| 408 timestamp, TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val, arg2_name, \ |
| 409 arg2_val) |
| 403 | 410 |
| 404 // Records a single END event for "name" immediately. If the category | 411 // Records a single END event for "name" immediately. If the category |
| 405 // is not enabled, then this does nothing. | 412 // is not enabled, then this does nothing. |
| 406 // - category and name strings must have application lifetime (statics or | 413 // - category and name strings must have application lifetime (statics or |
| 407 // literals). They may not include " chars. | 414 // literals). They may not include " chars. |
| 408 #define TRACE_EVENT_END0(category_group, name) \ | 415 #define TRACE_EVENT_END0(category_group, name) \ |
| 409 INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_END, \ | 416 INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_END, \ |
| 410 category_group, name, TRACE_EVENT_FLAG_NONE) | 417 category_group, name, TRACE_EVENT_FLAG_NONE) |
| 411 #define TRACE_EVENT_END1(category_group, name, arg1_name, arg1_val) \ | 418 #define TRACE_EVENT_END1(category_group, name, arg1_name, arg1_val) \ |
| 412 INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_END, \ | 419 INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_END, \ |
| (...skipping 29 matching lines...) Expand all Loading... |
| 442 #define TRACE_EVENT_COPY_END_WITH_ID_TID_AND_TIMESTAMP0( \ | 449 #define TRACE_EVENT_COPY_END_WITH_ID_TID_AND_TIMESTAMP0( \ |
| 443 category_group, name, id, thread_id, timestamp) \ | 450 category_group, name, id, thread_id, timestamp) \ |
| 444 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ | 451 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ |
| 445 TRACE_EVENT_PHASE_ASYNC_END, category_group, name, id, thread_id, \ | 452 TRACE_EVENT_PHASE_ASYNC_END, category_group, name, id, thread_id, \ |
| 446 timestamp, TRACE_EVENT_FLAG_COPY) | 453 timestamp, TRACE_EVENT_FLAG_COPY) |
| 447 #define TRACE_EVENT_COPY_END_WITH_ID_TID_AND_TIMESTAMP1( \ | 454 #define TRACE_EVENT_COPY_END_WITH_ID_TID_AND_TIMESTAMP1( \ |
| 448 category_group, name, id, thread_id, timestamp, arg1_name, arg1_val) \ | 455 category_group, name, id, thread_id, timestamp, arg1_name, arg1_val) \ |
| 449 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ | 456 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ |
| 450 TRACE_EVENT_PHASE_ASYNC_END, category_group, name, id, thread_id, \ | 457 TRACE_EVENT_PHASE_ASYNC_END, category_group, name, id, thread_id, \ |
| 451 timestamp, TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val) | 458 timestamp, TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val) |
| 459 #define TRACE_EVENT_COPY_END_WITH_ID_TID_AND_TIMESTAMP2( \ |
| 460 category_group, name, id, thread_id, timestamp, arg1_name, arg1_val, \ |
| 461 arg2_name, arg2_val) \ |
| 462 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ |
| 463 TRACE_EVENT_PHASE_ASYNC_END, category_group, name, id, thread_id, \ |
| 464 timestamp, TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val, arg2_name, \ |
| 465 arg2_val) |
| 452 | 466 |
| 453 // Records the value of a counter called "name" immediately. Value | 467 // Records the value of a counter called "name" immediately. Value |
| 454 // must be representable as a 32 bit integer. | 468 // must be representable as a 32 bit integer. |
| 455 // - category and name strings must have application lifetime (statics or | 469 // - category and name strings must have application lifetime (statics or |
| 456 // literals). They may not include " chars. | 470 // literals). They may not include " chars. |
| 457 #define TRACE_COUNTER1(category_group, name, value) \ | 471 #define TRACE_COUNTER1(category_group, name, value) \ |
| 458 INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_COUNTER, \ | 472 INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_COUNTER, \ |
| 459 category_group, name, TRACE_EVENT_FLAG_NONE, \ | 473 category_group, name, TRACE_EVENT_FLAG_NONE, \ |
| 460 "value", static_cast<int>(value)) | 474 "value", static_cast<int>(value)) |
| 461 #define TRACE_COPY_COUNTER1(category_group, name, value) \ | 475 #define TRACE_COPY_COUNTER1(category_group, name, value) \ |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 // - |id| is used to match a child NESTABLE_ASYNC event with its parent | 709 // - |id| is used to match a child NESTABLE_ASYNC event with its parent |
| 696 // NESTABLE_ASYNC event. Therefore, events in the same nested event tree must | 710 // NESTABLE_ASYNC event. Therefore, events in the same nested event tree must |
| 697 // be logged using the same id and category_group. | 711 // be logged using the same id and category_group. |
| 698 // | 712 // |
| 699 // Unmatched NESTABLE_ASYNC_END event will be parsed as an event that starts | 713 // Unmatched NESTABLE_ASYNC_END event will be parsed as an event that starts |
| 700 // at the first NESTABLE_ASYNC event of that id, and unmatched | 714 // at the first NESTABLE_ASYNC event of that id, and unmatched |
| 701 // NESTABLE_ASYNC_BEGIN event will be parsed as an event that ends at the last | 715 // NESTABLE_ASYNC_BEGIN event will be parsed as an event that ends at the last |
| 702 // NESTABLE_ASYNC event of that id. Corresponding warning messages for | 716 // NESTABLE_ASYNC event of that id. Corresponding warning messages for |
| 703 // unmatched events will be shown in the analysis view. | 717 // unmatched events will be shown in the analysis view. |
| 704 | 718 |
| 705 // Records a single NESTABLE_ASYNC_BEGIN event called "name" immediately, with 2 | 719 // Records a single NESTABLE_ASYNC_BEGIN event called "name" immediately, with |
| 706 // associated arguments. If the category is not enabled, then this does nothing. | 720 // 0, 1 or 2 associated arguments. If the category is not enabled, then this |
| 721 // does nothing. |
| 722 #define TRACE_EVENT_NESTABLE_ASYNC_BEGIN0(category_group, name, id) \ |
| 723 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_BEGIN, \ |
| 724 category_group, name, id, TRACE_EVENT_FLAG_NONE) |
| 725 #define TRACE_EVENT_NESTABLE_ASYNC_BEGIN1(category_group, name, id, arg1_name, \ |
| 726 arg1_val) \ |
| 727 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_BEGIN, \ |
| 728 category_group, name, id, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val) |
| 707 #define TRACE_EVENT_NESTABLE_ASYNC_BEGIN2(category_group, name, id, arg1_name, \ | 729 #define TRACE_EVENT_NESTABLE_ASYNC_BEGIN2(category_group, name, id, arg1_name, \ |
| 708 arg1_val, arg2_name, arg2_val) \ | 730 arg1_val, arg2_name, arg2_val) \ |
| 709 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_BEGIN, \ | 731 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_BEGIN, \ |
| 710 category_group, name, id, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, \ | 732 category_group, name, id, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, \ |
| 711 arg2_name, arg2_val) | 733 arg2_name, arg2_val) |
| 734 // Records a single NESTABLE_ASYNC_END event called "name" immediately, with 0, |
| 735 // 1, or 2 associated arguments. If the category is not enabled, then this does |
| 736 // nothing. |
| 737 #define TRACE_EVENT_NESTABLE_ASYNC_END0(category_group, name, id) \ |
| 738 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_END, \ |
| 739 category_group, name, id, TRACE_EVENT_FLAG_NONE) |
| 740 #define TRACE_EVENT_NESTABLE_ASYNC_END1(category_group, name, id, arg1_name, \ |
| 741 arg1_val) \ |
| 742 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_END, \ |
| 743 category_group, name, id, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val) |
| 744 #define TRACE_EVENT_NESTABLE_ASYNC_END2(category_group, name, id, arg1_name, \ |
| 745 arg1_val, arg2_name, arg2_val) \ |
| 746 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_END, \ |
| 747 category_group, name, id, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, \ |
| 748 arg2_name, arg2_val) |
| 749 |
| 712 #define TRACE_EVENT_COPY_NESTABLE_ASYNC_BEGIN_WITH_TTS2(category_group, name, \ | 750 #define TRACE_EVENT_COPY_NESTABLE_ASYNC_BEGIN_WITH_TTS2(category_group, name, \ |
| 713 id, arg1_name, arg1_val, arg2_name, arg2_val) \ | 751 id, arg1_name, arg1_val, arg2_name, arg2_val) \ |
| 714 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_BEGIN, \ | 752 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_BEGIN, \ |
| 715 category_group, name, id, \ | 753 category_group, name, id, \ |
| 716 TRACE_EVENT_FLAG_ASYNC_TTS | TRACE_EVENT_FLAG_COPY, \ | 754 TRACE_EVENT_FLAG_ASYNC_TTS | TRACE_EVENT_FLAG_COPY, \ |
| 717 arg1_name, arg1_val, arg2_name, arg2_val) | 755 arg1_name, arg1_val, arg2_name, arg2_val) |
| 718 | |
| 719 // Records a single NESTABLE_ASYNC_END event called "name" immediately, with 2 | |
| 720 // associated arguments. If the category is not enabled, then this does nothing. | |
| 721 #define TRACE_EVENT_NESTABLE_ASYNC_END2(category_group, name, id, arg1_name, \ | |
| 722 arg1_val, arg2_name, arg2_val) \ | |
| 723 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_END, \ | |
| 724 category_group, name, id, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, \ | |
| 725 arg2_name, arg2_val) | |
| 726 #define TRACE_EVENT_COPY_NESTABLE_ASYNC_END_WITH_TTS2(category_group, name, \ | 756 #define TRACE_EVENT_COPY_NESTABLE_ASYNC_END_WITH_TTS2(category_group, name, \ |
| 727 id, arg1_name, arg1_val, arg2_name, arg2_val) \ | 757 id, arg1_name, arg1_val, arg2_name, arg2_val) \ |
| 728 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_END, \ | 758 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_END, \ |
| 729 category_group, name, id, \ | 759 category_group, name, id, \ |
| 730 TRACE_EVENT_FLAG_ASYNC_TTS | TRACE_EVENT_FLAG_COPY, \ | 760 TRACE_EVENT_FLAG_ASYNC_TTS | TRACE_EVENT_FLAG_COPY, \ |
| 731 arg1_name, arg1_val, arg2_name, arg2_val) | 761 arg1_name, arg1_val, arg2_name, arg2_val) |
| 732 | 762 |
| 733 // Records a single NESTABLE_ASYNC_INSTANT event called "name" immediately, | 763 // Records a single NESTABLE_ASYNC_INSTANT event called "name" immediately, |
| 734 // with 2 associated arguments. If the category is not enabled, then this | 764 // with 2 associated arguments. If the category is not enabled, then this |
| 735 // does nothing. | 765 // does nothing. |
| (...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1438 phase, category_group_enabled, name, id, thread_id, timestamp, | 1468 phase, category_group_enabled, name, id, thread_id, timestamp, |
| 1439 kZeroNumArgs, NULL, NULL, NULL, NULL, flags); | 1469 kZeroNumArgs, NULL, NULL, NULL, NULL, flags); |
| 1440 } | 1470 } |
| 1441 | 1471 |
| 1442 static inline base::trace_event::TraceEventHandle AddTraceEvent( | 1472 static inline base::trace_event::TraceEventHandle AddTraceEvent( |
| 1443 char phase, | 1473 char phase, |
| 1444 const unsigned char* category_group_enabled, | 1474 const unsigned char* category_group_enabled, |
| 1445 const char* name, | 1475 const char* name, |
| 1446 unsigned long long id, | 1476 unsigned long long id, |
| 1447 unsigned char flags) { | 1477 unsigned char flags) { |
| 1448 int thread_id = static_cast<int>(base::PlatformThread::CurrentId()); | 1478 const int thread_id = static_cast<int>(base::PlatformThread::CurrentId()); |
| 1449 base::TimeTicks now = base::TimeTicks::NowFromSystemTraceTime(); | 1479 const base::TimeTicks now = base::TimeTicks::NowFromSystemTraceTime(); |
| 1450 return AddTraceEventWithThreadIdAndTimestamp(phase, category_group_enabled, | 1480 return AddTraceEventWithThreadIdAndTimestamp(phase, category_group_enabled, |
| 1451 name, id, thread_id, now, flags); | 1481 name, id, thread_id, now, flags); |
| 1452 } | 1482 } |
| 1453 | 1483 |
| 1454 template<class ARG1_TYPE> | 1484 template<class ARG1_TYPE> |
| 1455 static inline base::trace_event::TraceEventHandle | 1485 static inline base::trace_event::TraceEventHandle |
| 1456 AddTraceEventWithThreadIdAndTimestamp( | 1486 AddTraceEventWithThreadIdAndTimestamp( |
| 1457 char phase, | 1487 char phase, |
| 1458 const unsigned char* category_group_enabled, | 1488 const unsigned char* category_group_enabled, |
| 1459 const char* name, | 1489 const char* name, |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1648 const char* name_; | 1678 const char* name_; |
| 1649 IDType id_; | 1679 IDType id_; |
| 1650 | 1680 |
| 1651 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); | 1681 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); |
| 1652 }; | 1682 }; |
| 1653 | 1683 |
| 1654 } // namespace trace_event | 1684 } // namespace trace_event |
| 1655 } // namespace base | 1685 } // namespace base |
| 1656 | 1686 |
| 1657 #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_ | 1687 #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_ |
| OLD | NEW |