OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef INCLUDE_DART_TOOLS_API_H_ | 5 #ifndef INCLUDE_DART_TOOLS_API_H_ |
6 #define INCLUDE_DART_TOOLS_API_H_ | 6 #define INCLUDE_DART_TOOLS_API_H_ |
7 | 7 |
8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
9 | 9 |
10 /** \mainpage Dart Tools Embedding API Reference | 10 /** \mainpage Dart Tools Embedding API Reference |
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 const char* event_kind, | 872 const char* event_kind, |
873 const uint8_t* bytes, | 873 const uint8_t* bytes, |
874 intptr_t bytes_length); | 874 intptr_t bytes_length); |
875 | 875 |
876 /* | 876 /* |
877 * ======== | 877 * ======== |
878 * Timeline | 878 * Timeline |
879 * ======== | 879 * ======== |
880 */ | 880 */ |
881 | 881 |
| 882 /** |
| 883 * Returns a timestamp in microseconds. This timestamp is suitable for |
| 884 * passing into the timeline system. |
| 885 * |
| 886 * \return A timestamp that can be passed to the timeline system. |
| 887 */ |
| 888 DART_EXPORT int64_t Dart_TimelineGetMicros(); |
| 889 |
882 /** Timeline stream for Dart API calls */ | 890 /** Timeline stream for Dart API calls */ |
883 #define DART_TIMELINE_STREAM_API (1 << 0) | 891 #define DART_TIMELINE_STREAM_API (1 << 0) |
884 /** Timeline stream for compiler events */ | 892 /** Timeline stream for compiler events */ |
885 #define DART_TIMELINE_STREAM_COMPILER (1 << 1) | 893 #define DART_TIMELINE_STREAM_COMPILER (1 << 1) |
886 /** Timeline stream for embedder provided events */ | 894 /** Timeline stream for embedder provided events */ |
887 #define DART_TIMELINE_STREAM_EMBEDDER (1 << 2) | 895 #define DART_TIMELINE_STREAM_EMBEDDER (1 << 2) |
888 /** Timeline stream for GC events */ | 896 /** Timeline stream for GC events */ |
889 #define DART_TIMELINE_STREAM_GC (1 << 3) | 897 #define DART_TIMELINE_STREAM_GC (1 << 3) |
890 /** Timeline stream for isolate events */ | 898 /** Timeline stream for isolate events */ |
891 #define DART_TIMELINE_STREAM_ISOLATE (1 << 4) | 899 #define DART_TIMELINE_STREAM_ISOLATE (1 << 4) |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
969 * \param consumer A Dart_StreamConsumer. | 977 * \param consumer A Dart_StreamConsumer. |
970 * \param user_data User data passed into consumer. | 978 * \param user_data User data passed into consumer. |
971 * | 979 * |
972 * NOTE: The trace-event format is documented here: https://goo.gl/hDZw5M | 980 * NOTE: The trace-event format is documented here: https://goo.gl/hDZw5M |
973 * | 981 * |
974 * \return True if a stream was output. | 982 * \return True if a stream was output. |
975 */ | 983 */ |
976 DART_EXPORT bool Dart_TimelineGetTrace(Dart_StreamConsumer consumer, | 984 DART_EXPORT bool Dart_TimelineGetTrace(Dart_StreamConsumer consumer, |
977 void* user_data); | 985 void* user_data); |
978 | 986 |
979 | |
980 /** | 987 /** |
981 * Get the timeline for entire VM (including all isolates). | 988 * Get the timeline for entire VM (including all isolates). |
982 * | 989 * |
983 * NOTE: The timeline retrieved from this API call may not include the most | 990 * NOTE: The timeline retrieved from this API call may not include the most |
984 * recent events. | 991 * recent events. |
985 * | 992 * |
986 * \param consumer A Dart_StreamConsumer. | 993 * \param consumer A Dart_StreamConsumer. |
987 * \param user_data User data passed into consumer. | 994 * \param user_data User data passed into consumer. |
988 * | 995 * |
989 * NOTE: The trace-event format is documented here: https://goo.gl/hDZw5M | 996 * NOTE: The trace-event format is documented here: https://goo.gl/hDZw5M |
990 * | 997 * |
991 * \return True if a stream was output. | 998 * \return True if a stream was output. |
992 */ | 999 */ |
993 DART_EXPORT bool Dart_GlobalTimelineGetTrace(Dart_StreamConsumer consumer, | 1000 DART_EXPORT bool Dart_GlobalTimelineGetTrace(Dart_StreamConsumer consumer, |
994 void* user_data); | 1001 void* user_data); |
995 | 1002 |
996 /** | 1003 /** |
997 * Add a duration timeline event to the embedder stream for the current isolate. | 1004 * Add a duration timeline event to the embedder stream for the current isolate. |
998 * | 1005 * |
999 * \param label The name of the event. | 1006 * \param label The name of the event. |
1000 * \param start_micros The start of the duration (in microseconds) | 1007 * \param start_micros The start of the duration (in microseconds) |
1001 * \param end_micros The end of the duration (in microseconds) | 1008 * \param end_micros The end of the duration (in microseconds) |
1002 * | 1009 * |
1003 * NOTE: On Posix platforms you should use gettimeofday and on Windows platforms | 1010 * NOTE: All timestamps should be acquired from Dart_TimelineGetMicros. |
1004 * you should use GetSystemTimeAsFileTime to get the time values. | |
1005 */ | 1011 */ |
1006 DART_EXPORT Dart_Handle Dart_TimelineDuration(const char* label, | 1012 DART_EXPORT Dart_Handle Dart_TimelineDuration(const char* label, |
1007 int64_t start_micros, | 1013 int64_t start_micros, |
1008 int64_t end_micros); | 1014 int64_t end_micros); |
1009 | 1015 |
1010 | 1016 |
1011 /** | 1017 /** |
1012 * Add an instant timeline event to the embedder stream for the current isolate. | 1018 * Add an instant timeline event to the embedder stream for the current isolate. |
1013 * | 1019 * |
1014 * \param label The name of event. | 1020 * \param label The name of event. |
1015 * | 1021 * |
1016 * NOTE: On Posix platforms this call uses gettimeofday and on Windows platforms | 1022 * NOTE: All timestamps should be acquired from Dart_TimelineGetMicros. |
1017 * this call uses GetSystemTimeAsFileTime to get the current time. | |
1018 */ | 1023 */ |
1019 DART_EXPORT Dart_Handle Dart_TimelineInstant(const char* label); | 1024 DART_EXPORT Dart_Handle Dart_TimelineInstant(const char* label); |
1020 | 1025 |
1021 | 1026 |
1022 /** | 1027 /** |
1023 * Adds an asynchronous begin timeline event to the embedder stream for the | 1028 * Adds an asynchronous begin timeline event to the embedder stream for the |
1024 * current isolate. | 1029 * current isolate. |
1025 * | 1030 * |
1026 * \param label The name of event. | 1031 * \param label The name of event. |
1027 * | 1032 * |
1028 * \return Returns an asynchronous id that must be passed to | 1033 * \return Returns an asynchronous id that must be passed to |
1029 * Dart_TimelineAsyncInstant and Dart_TimelineAsyncEnd. If the asynchronous | 1034 * Dart_TimelineAsyncInstant and Dart_TimelineAsyncEnd. If the asynchronous |
1030 * id is less than 0 the event was not added to the timeline and subsequent | 1035 * id is less than 0 the event was not added to the timeline and subsequent |
1031 * calls to Dart_TimelineAsyncInstant and Dart_TimelineAsyncEnd will become | 1036 * calls to Dart_TimelineAsyncInstant and Dart_TimelineAsyncEnd will become |
1032 * no-ops. | 1037 * no-ops. |
1033 * | 1038 * |
1034 * NOTE: On Posix platforms this call uses gettimeofday and on Windows platforms | 1039 * NOTE: All timestamps should be acquired from Dart_TimelineGetMicros. |
1035 * this call uses GetSystemTimeAsFileTime to get the current time. | |
1036 */ | 1040 */ |
1037 DART_EXPORT Dart_Handle Dart_TimelineAsyncBegin(const char* label, | 1041 DART_EXPORT Dart_Handle Dart_TimelineAsyncBegin(const char* label, |
1038 int64_t* async_id); | 1042 int64_t* async_id); |
1039 | 1043 |
1040 | 1044 |
1041 /** | 1045 /** |
1042 * Adds an asynchronous instant timeline event to the embedder stream for the | 1046 * Adds an asynchronous instant timeline event to the embedder stream for the |
1043 * current isolate. | 1047 * current isolate. |
1044 * | 1048 * |
1045 * \param label The name of event. | 1049 * \param label The name of event. |
1046 * | 1050 * |
1047 * \return Returns an asynchronous id that must be passed to | 1051 * \return Returns an asynchronous id that must be passed to |
1048 * Dart_TimelineAsyncInstant and Dart_TimelineAsyncEnd. | 1052 * Dart_TimelineAsyncInstant and Dart_TimelineAsyncEnd. |
1049 * | 1053 * |
1050 * NOTE: On Posix platforms this call uses gettimeofday and on Windows platforms | 1054 * NOTE: All timestamps should be acquired from Dart_TimelineGetMicros. |
1051 * this call uses GetSystemTimeAsFileTime to get the current time. | |
1052 */ | 1055 */ |
1053 DART_EXPORT Dart_Handle Dart_TimelineAsyncInstant(const char* label, | 1056 DART_EXPORT Dart_Handle Dart_TimelineAsyncInstant(const char* label, |
1054 int64_t async_id); | 1057 int64_t async_id); |
1055 | 1058 |
1056 | 1059 |
1057 /** | 1060 /** |
1058 * Adds an asynchronous end timeline event to the embedder stream for the | 1061 * Adds an asynchronous end timeline event to the embedder stream for the |
1059 * current isolate. | 1062 * current isolate. |
1060 * | 1063 * |
1061 * \param label The name of event. | 1064 * \param label The name of event. |
1062 * | 1065 * |
1063 * \return Returns an asynchronous id that must be passed to | 1066 * \return Returns an asynchronous id that must be passed to |
1064 * Dart_TimelineAsyncInstant and Dart_TimelineAsyncEnd. | 1067 * Dart_TimelineAsyncInstant and Dart_TimelineAsyncEnd. |
1065 * | 1068 * |
1066 * NOTE: On Posix platforms this call uses gettimeofday and on Windows platforms | 1069 * NOTE: All timestamps should be acquired from Dart_TimelineGetMicros. |
1067 * this call uses GetSystemTimeAsFileTime to get the current time. | |
1068 */ | 1070 */ |
1069 DART_EXPORT Dart_Handle Dart_TimelineAsyncEnd(const char* label, | 1071 DART_EXPORT Dart_Handle Dart_TimelineAsyncEnd(const char* label, |
1070 int64_t async_id); | 1072 int64_t async_id); |
1071 | 1073 |
1072 #endif // INCLUDE_DART_TOOLS_API_H_ | 1074 #endif // INCLUDE_DART_TOOLS_API_H_ |
OLD | NEW |