Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: base/debug/trace_event.h

Issue 536503002: Add NESTABLE_ASYNC APIs to Tracing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Comments Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 category_group, name, id, TRACE_EVENT_FLAG_NONE, \ 503 category_group, name, id, TRACE_EVENT_FLAG_NONE, \
504 value1_name, static_cast<int>(value1_val), \ 504 value1_name, static_cast<int>(value1_val), \
505 value2_name, static_cast<int>(value2_val)) 505 value2_name, static_cast<int>(value2_val))
506 #define TRACE_COPY_COUNTER_ID2(category_group, name, id, value1_name, \ 506 #define TRACE_COPY_COUNTER_ID2(category_group, name, id, value1_name, \
507 value1_val, value2_name, value2_val) \ 507 value1_val, value2_name, value2_val) \
508 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_COUNTER, \ 508 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_COUNTER, \
509 category_group, name, id, TRACE_EVENT_FLAG_COPY, \ 509 category_group, name, id, TRACE_EVENT_FLAG_COPY, \
510 value1_name, static_cast<int>(value1_val), \ 510 value1_name, static_cast<int>(value1_val), \
511 value2_name, static_cast<int>(value2_val)) 511 value2_name, static_cast<int>(value2_val))
512 512
513 513 // ASYNC_STEP_* APIs should be only used by legacy code. New code should
514 // consider using NESTABLE_ASYNC_* APIs to describe substeps within an async
515 // event.
514 // Records a single ASYNC_BEGIN event called "name" immediately, with 0, 1 or 2 516 // Records a single ASYNC_BEGIN event called "name" immediately, with 0, 1 or 2
515 // associated arguments. If the category is not enabled, then this 517 // associated arguments. If the category is not enabled, then this
516 // does nothing. 518 // does nothing.
517 // - category and name strings must have application lifetime (statics or 519 // - category and name strings must have application lifetime (statics or
518 // literals). They may not include " chars. 520 // literals). They may not include " chars.
519 // - |id| is used to match the ASYNC_BEGIN event with the ASYNC_END event. ASYNC 521 // - |id| is used to match the ASYNC_BEGIN event with the ASYNC_END event. ASYNC
520 // events are considered to match if their category_group, name and id values 522 // events are considered to match if their category_group, name and id values
521 // all match. |id| must either be a pointer or an integer value up to 64 bits. 523 // all match. |id| must either be a pointer or an integer value up to 64 bits.
522 // If it's a pointer, the bits will be xored with a hash of the process ID so 524 // If it's a pointer, the bits will be xored with a hash of the process ID so
523 // that the same pointer on two different processes will not collide. 525 // that the same pointer on two different processes will not collide.
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 arg1_name, arg1_val, arg2_name, arg2_val) 629 arg1_name, arg1_val, arg2_name, arg2_val)
628 630
629 // Similar to TRACE_EVENT_ASYNC_ENDx but with a custom |at| timestamp provided. 631 // Similar to TRACE_EVENT_ASYNC_ENDx but with a custom |at| timestamp provided.
630 #define TRACE_EVENT_ASYNC_END_WITH_TIMESTAMP0(category_group, \ 632 #define TRACE_EVENT_ASYNC_END_WITH_TIMESTAMP0(category_group, \
631 name, id, timestamp) \ 633 name, id, timestamp) \
632 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ 634 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
633 TRACE_EVENT_PHASE_ASYNC_END, category_group, name, id, \ 635 TRACE_EVENT_PHASE_ASYNC_END, category_group, name, id, \
634 static_cast<int>(base::PlatformThread::CurrentId()), \ 636 static_cast<int>(base::PlatformThread::CurrentId()), \
635 timestamp, TRACE_EVENT_FLAG_NONE) 637 timestamp, TRACE_EVENT_FLAG_NONE)
636 638
639 // NESTABLE_ASYNC_* APIs are used to describe an async operation, which can
640 // be nested within a NESTABLE_ASYNC event and/or have inner NESTABLE_ASYNC
641 // events.
642 // - category and name strings must have application lifetime (statics or
643 // literals). They may not include " chars.
644 // - |id| is used to match the NESTABLE_ASYNC_BEGIN event with the
645 // NESTABLE_ASYNC_END event. Events are considered to match if their
646 // category_group, name and id values all match. |id| must either be a
647 // pointer or an integer value up to 64 bits. If it's a pointer, the bits
648 // will be xored with a hash of the process ID so that the same pointer on two
649 // different processes will not collide.
650 //
651 // Unmatched NESTABLE_ASYNC_END event will be parsed as an instant event,
652 // and unmatched NESTABLE_ASYNC_BEGIN event will be parsed as an event that
653 // ends at the last NESTABLE_ASYNC_END event of that |id|.
654
655 // Records a single NESTABLE_ASYNC_BEGIN event called "name" immediately, with 2
656 // associated arguments. If the category is not enabled, then this does nothing.
657 #define TRACE_EVENT_NESTABLE_ASYNC_BEGIN2(category_group, name, id, arg1_name, \
658 arg1_val, arg2_name, arg2_val) \
659 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_BEGIN, \
660 category_group, name, id, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, \
661 arg2_name, arg2_val)
662 // Records a single NESTABLE_ASYNC_END event called "name" immediately, with 2
663 // associated arguments. If the category is not enabled, then this does nothing.
664 #define TRACE_EVENT_NESTABLE_ASYNC_END2(category_group, name, id, arg1_name, \
665 arg1_val, arg2_name, arg2_val) \
666 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_END, \
667 category_group, name, id, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, \
668 arg2_name, arg2_val)
669 // Records a single NESTABLE_ASYNC_INSTANT event called "name" immediately,
670 // with 2 associated arguments. If the category is not enabled, then this
671 // does nothing.
672 #define TRACE_EVENT_NESTABLE_ASYNC_INSTANT2(category_group, name, id, \
673 arg1_name, arg1_val, arg2_name, arg2_val) \
674 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_INSTANT, \
675 category_group, name, id, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, \
676 arg2_name, arg2_val)
677
637 // Records a single FLOW_BEGIN event called "name" immediately, with 0, 1 or 2 678 // 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 679 // associated arguments. If the category is not enabled, then this
639 // does nothing. 680 // does nothing.
640 // - category and name strings must have application lifetime (statics or 681 // - category and name strings must have application lifetime (statics or
641 // literals). They may not include " chars. 682 // literals). They may not include " chars.
642 // - |id| is used to match the FLOW_BEGIN event with the FLOW_END event. FLOW 683 // - |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 684 // 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. 685 // 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 686 // 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. 687 // that the same pointer on two different processes will not collide.
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 997
957 // Phase indicates the nature of an event entry. E.g. part of a begin/end pair. 998 // Phase indicates the nature of an event entry. E.g. part of a begin/end pair.
958 #define TRACE_EVENT_PHASE_BEGIN ('B') 999 #define TRACE_EVENT_PHASE_BEGIN ('B')
959 #define TRACE_EVENT_PHASE_END ('E') 1000 #define TRACE_EVENT_PHASE_END ('E')
960 #define TRACE_EVENT_PHASE_COMPLETE ('X') 1001 #define TRACE_EVENT_PHASE_COMPLETE ('X')
961 #define TRACE_EVENT_PHASE_INSTANT ('I') 1002 #define TRACE_EVENT_PHASE_INSTANT ('I')
962 #define TRACE_EVENT_PHASE_ASYNC_BEGIN ('S') 1003 #define TRACE_EVENT_PHASE_ASYNC_BEGIN ('S')
963 #define TRACE_EVENT_PHASE_ASYNC_STEP_INTO ('T') 1004 #define TRACE_EVENT_PHASE_ASYNC_STEP_INTO ('T')
964 #define TRACE_EVENT_PHASE_ASYNC_STEP_PAST ('p') 1005 #define TRACE_EVENT_PHASE_ASYNC_STEP_PAST ('p')
965 #define TRACE_EVENT_PHASE_ASYNC_END ('F') 1006 #define TRACE_EVENT_PHASE_ASYNC_END ('F')
1007 #define TRACE_EVENT_PHASE_NESTABLE_ASYNC_BEGIN ('b')
1008 #define TRACE_EVENT_PHASE_NESTABLE_ASYNC_END ('e')
1009 #define TRACE_EVENT_PHASE_NESTABLE_ASYNC_INSTANT ('n')
966 #define TRACE_EVENT_PHASE_FLOW_BEGIN ('s') 1010 #define TRACE_EVENT_PHASE_FLOW_BEGIN ('s')
967 #define TRACE_EVENT_PHASE_FLOW_STEP ('t') 1011 #define TRACE_EVENT_PHASE_FLOW_STEP ('t')
968 #define TRACE_EVENT_PHASE_FLOW_END ('f') 1012 #define TRACE_EVENT_PHASE_FLOW_END ('f')
969 #define TRACE_EVENT_PHASE_METADATA ('M') 1013 #define TRACE_EVENT_PHASE_METADATA ('M')
970 #define TRACE_EVENT_PHASE_COUNTER ('C') 1014 #define TRACE_EVENT_PHASE_COUNTER ('C')
971 #define TRACE_EVENT_PHASE_SAMPLE ('P') 1015 #define TRACE_EVENT_PHASE_SAMPLE ('P')
972 #define TRACE_EVENT_PHASE_CREATE_OBJECT ('N') 1016 #define TRACE_EVENT_PHASE_CREATE_OBJECT ('N')
973 #define TRACE_EVENT_PHASE_SNAPSHOT_OBJECT ('O') 1017 #define TRACE_EVENT_PHASE_SNAPSHOT_OBJECT ('O')
974 #define TRACE_EVENT_PHASE_DELETE_OBJECT ('D') 1018 #define TRACE_EVENT_PHASE_DELETE_OBJECT ('D')
975 1019
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
1526 const char* name_; 1570 const char* name_;
1527 IDType id_; 1571 IDType id_;
1528 1572
1529 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); 1573 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject);
1530 }; 1574 };
1531 1575
1532 } // namespace debug 1576 } // namespace debug
1533 } // namespace base 1577 } // namespace base
1534 1578
1535 #endif /* BASE_DEBUG_TRACE_EVENT_H_ */ 1579 #endif /* BASE_DEBUG_TRACE_EVENT_H_ */
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698