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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 arg1_val) \ | 553 arg1_val) \ |
554 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_BEGIN, \ | 554 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_BEGIN, \ |
555 category_group, name, id, TRACE_EVENT_FLAG_COPY, \ | 555 category_group, name, id, TRACE_EVENT_FLAG_COPY, \ |
556 arg1_name, arg1_val) | 556 arg1_name, arg1_val) |
557 #define TRACE_EVENT_COPY_ASYNC_BEGIN2(category_group, name, id, arg1_name, \ | 557 #define TRACE_EVENT_COPY_ASYNC_BEGIN2(category_group, name, id, arg1_name, \ |
558 arg1_val, arg2_name, arg2_val) \ | 558 arg1_val, arg2_name, arg2_val) \ |
559 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_BEGIN, \ | 559 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_BEGIN, \ |
560 category_group, name, id, TRACE_EVENT_FLAG_COPY, \ | 560 category_group, name, id, TRACE_EVENT_FLAG_COPY, \ |
561 arg1_name, arg1_val, arg2_name, arg2_val) | 561 arg1_name, arg1_val, arg2_name, arg2_val) |
562 | 562 |
| 563 // Similar to TRACE_EVENT_ASYNC_BEGINx but with a custom |at| timestamp |
| 564 // provided. |
| 565 #define TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP0(category_group, \ |
| 566 name, id, timestamp) \ |
| 567 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ |
| 568 TRACE_EVENT_PHASE_ASYNC_BEGIN, category_group, name, id, \ |
| 569 static_cast<int>(base::PlatformThread::CurrentId()), \ |
| 570 timestamp, TRACE_EVENT_FLAG_NONE) |
| 571 |
563 // Records a single ASYNC_STEP_INTO event for |step| immediately. If the | 572 // Records a single ASYNC_STEP_INTO event for |step| immediately. If the |
564 // category is not enabled, then this does nothing. The |name| and |id| must | 573 // category is not enabled, then this does nothing. The |name| and |id| must |
565 // match the ASYNC_BEGIN event above. The |step| param identifies this step | 574 // match the ASYNC_BEGIN event above. The |step| param identifies this step |
566 // within the async event. This should be called at the beginning of the next | 575 // within the async event. This should be called at the beginning of the next |
567 // phase of an asynchronous operation. The ASYNC_BEGIN event must not have any | 576 // phase of an asynchronous operation. The ASYNC_BEGIN event must not have any |
568 // ASYNC_STEP_PAST events. | 577 // ASYNC_STEP_PAST events. |
569 #define TRACE_EVENT_ASYNC_STEP_INTO0(category_group, name, id, step) \ | 578 #define TRACE_EVENT_ASYNC_STEP_INTO0(category_group, name, id, step) \ |
570 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_STEP_INTO, \ | 579 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_STEP_INTO, \ |
571 category_group, name, id, TRACE_EVENT_FLAG_NONE, "step", step) | 580 category_group, name, id, TRACE_EVENT_FLAG_NONE, "step", step) |
572 #define TRACE_EVENT_ASYNC_STEP_INTO1(category_group, name, id, step, \ | 581 #define TRACE_EVENT_ASYNC_STEP_INTO1(category_group, name, id, step, \ |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 arg1_val) \ | 619 arg1_val) \ |
611 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_END, \ | 620 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_END, \ |
612 category_group, name, id, TRACE_EVENT_FLAG_COPY, \ | 621 category_group, name, id, TRACE_EVENT_FLAG_COPY, \ |
613 arg1_name, arg1_val) | 622 arg1_name, arg1_val) |
614 #define TRACE_EVENT_COPY_ASYNC_END2(category_group, name, id, arg1_name, \ | 623 #define TRACE_EVENT_COPY_ASYNC_END2(category_group, name, id, arg1_name, \ |
615 arg1_val, arg2_name, arg2_val) \ | 624 arg1_val, arg2_name, arg2_val) \ |
616 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_END, \ | 625 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_END, \ |
617 category_group, name, id, TRACE_EVENT_FLAG_COPY, \ | 626 category_group, name, id, TRACE_EVENT_FLAG_COPY, \ |
618 arg1_name, arg1_val, arg2_name, arg2_val) | 627 arg1_name, arg1_val, arg2_name, arg2_val) |
619 | 628 |
| 629 // Similar to TRACE_EVENT_ASYNC_ENDx but with a custom |at| timestamp provided. |
| 630 #define TRACE_EVENT_ASYNC_END_WITH_TIMESTAMP0(category_group, \ |
| 631 name, id, timestamp) \ |
| 632 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ |
| 633 TRACE_EVENT_PHASE_ASYNC_END, category_group, name, id, \ |
| 634 static_cast<int>(base::PlatformThread::CurrentId()), \ |
| 635 timestamp, TRACE_EVENT_FLAG_NONE) |
620 | 636 |
621 // Records a single FLOW_BEGIN event called "name" immediately, with 0, 1 or 2 | 637 // Records a single FLOW_BEGIN event called "name" immediately, with 0, 1 or 2 |
622 // associated arguments. If the category is not enabled, then this | 638 // associated arguments. If the category is not enabled, then this |
623 // does nothing. | 639 // does nothing. |
624 // - category and name strings must have application lifetime (statics or | 640 // - category and name strings must have application lifetime (statics or |
625 // literals). They may not include " chars. | 641 // literals). They may not include " chars. |
626 // - |id| is used to match the FLOW_BEGIN event with the FLOW_END event. FLOW | 642 // - |id| is used to match the FLOW_BEGIN event with the FLOW_END event. FLOW |
627 // events are considered to match if their category_group, name and id values | 643 // events are considered to match if their category_group, name and id values |
628 // all match. |id| must either be a pointer or an integer value up to 64 bits. | 644 // all match. |id| must either be a pointer or an integer value up to 64 bits. |
629 // If it's a pointer, the bits will be xored with a hash of the process ID so | 645 // If it's a pointer, the bits will be xored with a hash of the process ID so |
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1510 const char* name_; | 1526 const char* name_; |
1511 IDType id_; | 1527 IDType id_; |
1512 | 1528 |
1513 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); | 1529 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); |
1514 }; | 1530 }; |
1515 | 1531 |
1516 } // namespace debug | 1532 } // namespace debug |
1517 } // namespace base | 1533 } // namespace base |
1518 | 1534 |
1519 #endif /* BASE_DEBUG_TRACE_EVENT_H_ */ | 1535 #endif /* BASE_DEBUG_TRACE_EVENT_H_ */ |
OLD | NEW |