| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 #define TRACE_EVENT_COPY_ASYNC_END1(category, name, id, arg1_name, arg1_val) \ | 444 #define TRACE_EVENT_COPY_ASYNC_END1(category, name, id, arg1_name, arg1_val) \ |
| 445 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_END, \ | 445 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_END, \ |
| 446 category, name, id, TRACE_EVENT_FLAG_COPY, \ | 446 category, name, id, TRACE_EVENT_FLAG_COPY, \ |
| 447 arg1_name, arg1_val) | 447 arg1_name, arg1_val) |
| 448 #define TRACE_EVENT_COPY_ASYNC_END2(category, name, id, arg1_name, arg1_val, \ | 448 #define TRACE_EVENT_COPY_ASYNC_END2(category, name, id, arg1_name, arg1_val, \ |
| 449 arg2_name, arg2_val) \ | 449 arg2_name, arg2_val) \ |
| 450 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_END, \ | 450 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_END, \ |
| 451 category, name, id, TRACE_EVENT_FLAG_COPY, \ | 451 category, name, id, TRACE_EVENT_FLAG_COPY, \ |
| 452 arg1_name, arg1_val, arg2_name, arg2_val) | 452 arg1_name, arg1_val, arg2_name, arg2_val) |
| 453 | 453 |
| 454 |
| 455 // Records a single FLOW_BEGIN event called "name" immediately, with 0, 1 or 2 |
| 456 // associated arguments. If the category is not enabled, then this |
| 457 // does nothing. |
| 458 // - category and name strings must have application lifetime (statics or |
| 459 // literals). They may not include " chars. |
| 460 // - |id| is used to match the FLOW_BEGIN event with the FLOW_END event. FLOW |
| 461 // events are considered to match if their category_group, name and id values |
| 462 // all match. |id| must either be a pointer or an integer value up to 64 bits. |
| 463 // If it's a pointer, the bits will be xored with a hash of the process ID so |
| 464 // that the same pointer on two different processes will not collide. |
| 465 // FLOW events are different from ASYNC events in how they are drawn by the |
| 466 // tracing UI. A FLOW defines asynchronous data flow, such as posting a task |
| 467 // (FLOW_BEGIN) and later executing that task (FLOW_END). Expect FLOWs to be |
| 468 // drawn as lines or arrows from FLOW_BEGIN scopes to FLOW_END scopes. Similar |
| 469 // to ASYNC, a FLOW can consist of multiple phases. The first phase is defined |
| 470 // by the FLOW_BEGIN calls. Additional phases can be defined using the FLOW_STEP |
| 471 // macros. When the operation completes, call FLOW_END. An async operation can |
| 472 // span threads and processes, but all events in that operation must use the |
| 473 // same |name| and |id|. Each event can have its own args. |
| 474 |
| 475 #define TRACE_EVENT_FLOW_BEGIN0(category, name, id) \ |
| 476 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_BEGIN, \ |
| 477 category, name, id, TRACE_EVENT_FLAG_NONE) |
| 478 #define TRACE_EVENT_FLOW_BEGIN1(category, name, id, arg1_name, arg1_val) \ |
| 479 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_BEGIN, \ |
| 480 category, name, id, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val) |
| 481 #define TRACE_EVENT_FLOW_BEGIN2(category, name, id, arg1_name, arg1_val, \ |
| 482 arg2_name, arg2_val) \ |
| 483 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_BEGIN, \ |
| 484 category, name, id, TRACE_EVENT_FLAG_NONE, \ |
| 485 arg1_name, arg1_val, arg2_name, arg2_val) |
| 486 |
| 487 |
| 488 // Records a single ASYNC_END event for "name" immediately. If the category |
| 489 // is not enabled, then this does nothing. |
| 490 #define TRACE_EVENT_FLOW_END0(category, name, id) \ |
| 491 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, \ |
| 492 category, name, id, TRACE_EVENT_FLAG_NONE) |
| 493 #define TRACE_EVENT_FLOW_END1(category, name, id, arg1_name, arg1_val) \ |
| 494 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, \ |
| 495 category, name, id, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val) |
| 496 #define TRACE_EVENT_FLOW_END2(category, name, id, arg1_name, arg1_val, \ |
| 497 arg2_name, arg2_val) \ |
| 498 INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_FLOW_END, \ |
| 499 category, name, id, TRACE_EVENT_FLAG_NONE, \ |
| 500 arg1_name, arg1_val, arg2_name, arg2_val) |
| 501 |
| 502 |
| 454 // Creates a scope of a sampling state with the given category and name (both mu
st | 503 // Creates a scope of a sampling state with the given category and name (both mu
st |
| 455 // be constant strings). These states are intended for a sampling profiler. | 504 // be constant strings). These states are intended for a sampling profiler. |
| 456 // Implementation note: we store category and name together because we don't | 505 // Implementation note: we store category and name together because we don't |
| 457 // want the inconsistency/expense of storing two pointers. | 506 // want the inconsistency/expense of storing two pointers. |
| 458 // |thread_bucket| is [0..2] and is used to statically isolate samples in one | 507 // |thread_bucket| is [0..2] and is used to statically isolate samples in one |
| 459 // thread from others. | 508 // thread from others. |
| 460 // | 509 // |
| 461 // { // The sampling state is set within this scope. | 510 // { // The sampling state is set within this scope. |
| 462 // TRACE_EVENT_SAMPLING_STATE_SCOPE_FOR_BUCKET(0, "category", "name"); | 511 // TRACE_EVENT_SAMPLING_STATE_SCOPE_FOR_BUCKET(0, "category", "name"); |
| 463 // ...; | 512 // ...; |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 #define TRACE_EVENT_PHASE_ASYNC_BEGIN ('S') | 690 #define TRACE_EVENT_PHASE_ASYNC_BEGIN ('S') |
| 642 #define TRACE_EVENT_PHASE_ASYNC_STEP_INTO ('T') | 691 #define TRACE_EVENT_PHASE_ASYNC_STEP_INTO ('T') |
| 643 #define TRACE_EVENT_PHASE_ASYNC_STEP_PAST ('p') | 692 #define TRACE_EVENT_PHASE_ASYNC_STEP_PAST ('p') |
| 644 #define TRACE_EVENT_PHASE_ASYNC_END ('F') | 693 #define TRACE_EVENT_PHASE_ASYNC_END ('F') |
| 645 #define TRACE_EVENT_PHASE_METADATA ('M') | 694 #define TRACE_EVENT_PHASE_METADATA ('M') |
| 646 #define TRACE_EVENT_PHASE_COUNTER ('C') | 695 #define TRACE_EVENT_PHASE_COUNTER ('C') |
| 647 #define TRACE_EVENT_PHASE_SAMPLE ('P') | 696 #define TRACE_EVENT_PHASE_SAMPLE ('P') |
| 648 #define TRACE_EVENT_PHASE_CREATE_OBJECT ('N') | 697 #define TRACE_EVENT_PHASE_CREATE_OBJECT ('N') |
| 649 #define TRACE_EVENT_PHASE_SNAPSHOT_OBJECT ('O') | 698 #define TRACE_EVENT_PHASE_SNAPSHOT_OBJECT ('O') |
| 650 #define TRACE_EVENT_PHASE_DELETE_OBJECT ('D') | 699 #define TRACE_EVENT_PHASE_DELETE_OBJECT ('D') |
| 700 #define TRACE_EVENT_PHASE_FLOW_BEGIN ('s') |
| 701 #define TRACE_EVENT_PHASE_FLOW_END ('f') |
| 651 | 702 |
| 652 // Flags for changing the behavior of TRACE_EVENT_API_ADD_TRACE_EVENT. | 703 // Flags for changing the behavior of TRACE_EVENT_API_ADD_TRACE_EVENT. |
| 653 #define TRACE_EVENT_FLAG_NONE (static_cast<unsigned char>(0)) | 704 #define TRACE_EVENT_FLAG_NONE (static_cast<unsigned char>(0)) |
| 654 #define TRACE_EVENT_FLAG_COPY (static_cast<unsigned char>(1 << 0)) | 705 #define TRACE_EVENT_FLAG_COPY (static_cast<unsigned char>(1 << 0)) |
| 655 #define TRACE_EVENT_FLAG_HAS_ID (static_cast<unsigned char>(1 << 1)) | 706 #define TRACE_EVENT_FLAG_HAS_ID (static_cast<unsigned char>(1 << 1)) |
| 656 #define TRACE_EVENT_FLAG_MANGLE_ID (static_cast<unsigned char>(1 << 2)) | 707 #define TRACE_EVENT_FLAG_MANGLE_ID (static_cast<unsigned char>(1 << 2)) |
| 657 | 708 |
| 658 // Type values for identifying types in the TraceValue union. | 709 // Type values for identifying types in the TraceValue union. |
| 659 #define TRACE_VALUE_TYPE_BOOL (static_cast<unsigned char>(1)) | 710 #define TRACE_VALUE_TYPE_BOOL (static_cast<unsigned char>(1)) |
| 660 #define TRACE_VALUE_TYPE_UINT (static_cast<unsigned char>(2)) | 711 #define TRACE_VALUE_TYPE_UINT (static_cast<unsigned char>(2)) |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1005 const char* m_categoryGroup; | 1056 const char* m_categoryGroup; |
| 1006 const char* m_name; | 1057 const char* m_name; |
| 1007 IDType m_id; | 1058 IDType m_id; |
| 1008 }; | 1059 }; |
| 1009 | 1060 |
| 1010 } // namespace TraceEvent | 1061 } // namespace TraceEvent |
| 1011 | 1062 |
| 1012 } // namespace blink | 1063 } // namespace blink |
| 1013 | 1064 |
| 1014 #endif | 1065 #endif |
| OLD | NEW |