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

Side by Side Diff: runtime/include/dart_tools_api.h

Issue 1811613002: Timeline API fixes for Flutter (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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 | runtime/lib/timeline.cc » ('j') | 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) 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 884 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 /** Timeline stream for Dart provided events */ 895 /** Timeline stream for Dart provided events */
896 #define DART_TIMELINE_STREAM_DART (1 << 2) 896 #define DART_TIMELINE_STREAM_DART (1 << 2)
897 /** Timeline stream for debugger provided events */ 897 /** Timeline stream for debugger provided events */
898 #define DART_TIMELINE_STREAM_DEBUGGER (1 << 3) 898 #define DART_TIMELINE_STREAM_DEBUGGER (1 << 3)
899 /** Timeline stream for embedder provided events */ 899 /** Timeline stream for embedder provided events */
900 #define DART_TIMELINE_STREAM_EMBEDDER (1 << 4) 900 #define DART_TIMELINE_STREAM_EMBEDDER (1 << 4)
901 /** Timeline stream for GC events */ 901 /** Timeline stream for GC events */
902 #define DART_TIMELINE_STREAM_GC (1 << 5) 902 #define DART_TIMELINE_STREAM_GC (1 << 5)
903 /** Timeline stream for isolate events */ 903 /** Timeline stream for isolate events */
904 #define DART_TIMELINE_STREAM_ISOLATE (1 << 6) 904 #define DART_TIMELINE_STREAM_ISOLATE (1 << 6)
905
906 /** Timeline stream for VM events */ 905 /** Timeline stream for VM events */
907 #define DART_TIMELINE_STREAM_VM (1 << 7) 906 #define DART_TIMELINE_STREAM_VM (1 << 7)
908 907
909 /** Enable all timeline stream recording for an isolate */ 908 /** All timeline streams */
910 #define DART_TIMELINE_STREAM_ALL (DART_TIMELINE_STREAM_API | \ 909 #define DART_TIMELINE_STREAM_ALL (DART_TIMELINE_STREAM_API | \
911 DART_TIMELINE_STREAM_COMPILER | \ 910 DART_TIMELINE_STREAM_COMPILER | \
912 DART_TIMELINE_STREAM_DART | \ 911 DART_TIMELINE_STREAM_DART | \
913 DART_TIMELINE_STREAM_DEBUGGER | \ 912 DART_TIMELINE_STREAM_DEBUGGER | \
914 DART_TIMELINE_STREAM_EMBEDDER | \ 913 DART_TIMELINE_STREAM_EMBEDDER | \
915 DART_TIMELINE_STREAM_GC | \ 914 DART_TIMELINE_STREAM_GC | \
916 DART_TIMELINE_STREAM_ISOLATE) 915 DART_TIMELINE_STREAM_ISOLATE | \
916 DART_TIMELINE_STREAM_VM)
917 917
918 /** Disable all timeline stream recording */ 918 /** Disable all timeline stream recording */
919 #define DART_TIMELINE_STREAM_DISABLE 0 919 #define DART_TIMELINE_STREAM_DISABLE 0
920 920
921 /**
922 * Start recording timeline events for the current isolate.
923 *
924 * \param stream_mask A bitmask of streams that should be recorded.
925 *
926 * NOTE: Calling with 0 disables recording of all streams.
927 */
928 DART_EXPORT void Dart_TimelineSetRecordedStreams(int64_t stream_mask);
929
930 921
931 /** 922 /**
932 * Start recording timeline events for the entire VM (including all isolates). 923 * Start recording timeline events for the entire VM (including all isolates).
933 * 924 *
934 * NOTE: When enabled, the global flag, will override the per-isolate flag.
935 *
936 * \param stream_mask A bitmask of streams that should be recorded. 925 * \param stream_mask A bitmask of streams that should be recorded.
937 * 926 *
938 * NOTE: Calling with 0 disables recording of all streams. 927 * NOTE: Calling with 0 disables recording of all streams.
939 */ 928 */
940 DART_EXPORT void Dart_GlobalTimelineSetRecordedStreams(int64_t stream_mask); 929 DART_EXPORT void Dart_GlobalTimelineSetRecordedStreams(int64_t stream_mask);
941 930
942 931
943 typedef enum { 932 typedef enum {
944 /** Indicates a new stream is being output */ 933 /** Indicates a new stream is being output */
945 Dart_StreamConsumer_kStart = 0, 934 Dart_StreamConsumer_kStart = 0,
(...skipping 24 matching lines...) Expand all
970 * At the end of each stream state will be DART_STREAM_CONSUMER_STATE_FINISH 959 * At the end of each stream state will be DART_STREAM_CONSUMER_STATE_FINISH
971 * and buffer will be NULL. 960 * and buffer will be NULL.
972 */ 961 */
973 typedef void (*Dart_StreamConsumer)( 962 typedef void (*Dart_StreamConsumer)(
974 Dart_StreamConsumer_State state, 963 Dart_StreamConsumer_State state,
975 const char* stream_name, 964 const char* stream_name,
976 const uint8_t* buffer, 965 const uint8_t* buffer,
977 intptr_t buffer_length, 966 intptr_t buffer_length,
978 void* stream_callback_data); 967 void* stream_callback_data);
979 968
980
981 /**
982 * Get the timeline for the current isolate in trace-event format
983 *
984 * \param consumer A Dart_StreamConsumer.
985 * \param user_data User data passed into consumer.
986 *
987 * NOTE: The trace-event format is documented here: https://goo.gl/hDZw5M
988 *
989 * \return True if a stream was output.
990 */
991 DART_EXPORT bool Dart_TimelineGetTrace(Dart_StreamConsumer consumer,
992 void* user_data);
993
994 /** 969 /**
995 * Get the timeline for entire VM (including all isolates). 970 * Get the timeline for entire VM (including all isolates).
996 * 971 *
997 * NOTE: The timeline retrieved from this API call may not include the most 972 * NOTE: The timeline retrieved from this API call may not include the most
998 * recent events. 973 * recent events.
999 * 974 *
1000 * \param consumer A Dart_StreamConsumer. 975 * \param consumer A Dart_StreamConsumer.
1001 * \param user_data User data passed into consumer. 976 * \param user_data User data passed into consumer.
1002 * 977 *
1003 * NOTE: The trace-event format is documented here: https://goo.gl/hDZw5M 978 * NOTE: The trace-event format is documented here: https://goo.gl/hDZw5M
1004 * 979 *
1005 * \return True if a stream was output. 980 * \return True if a stream was output.
1006 */ 981 */
1007 DART_EXPORT bool Dart_GlobalTimelineGetTrace(Dart_StreamConsumer consumer, 982 DART_EXPORT bool Dart_GlobalTimelineGetTrace(Dart_StreamConsumer consumer,
1008 void* user_data); 983 void* user_data);
1009 984
985 typedef enum {
986 Dart_Timeline_Event_Begin, // Phase = 'B'.
987 Dart_Timeline_Event_End, // Phase = 'E'.
988 Dart_Timeline_Event_Instant, // Phase = 'i'.
989 Dart_Timeline_Event_Duration, // Phase = 'X'.
990 } Dart_Timeline_Event_Type;
991
1010 /** 992 /**
1011 * Add a duration timeline event to the embedder stream for the current isolate. 993 * Add a timeline event to the embedder stream.
994 *
995 * \param label The name of the evnet.
996 * \param timestamp0 The first timestamp of the event.
997 * \param timestamp1_or_async_id The second timestamp of the event or
998 * the async id.
999 * \param argument_count The number of argument names and values.
1000 * \param argument_names An array of names of the arguments.
1001 * \param argument_values An array of values of the arguments.
1002 */
1003 DART_EXPORT void Dart_TimelineEvent(const char* label,
1004 int64_t timestamp0,
1005 int64_t timestamp1_or_async_id,
1006 Dart_Timeline_Event_Type type,
1007 intptr_t argument_count,
1008 const char** argument_names,
1009 const char** argument_values);
1010
1011 /**
1012 * Add a duration timeline event to the embedder stream.
1012 * 1013 *
1013 * \param label The name of the event. 1014 * \param label The name of the event.
1014 * \param start_micros The start of the duration (in microseconds) 1015 * \param start_micros The start of the duration (in microseconds)
1015 * \param end_micros The end of the duration (in microseconds) 1016 * \param end_micros The end of the duration (in microseconds)
1016 * 1017 *
1017 * NOTE: All timestamps should be acquired from Dart_TimelineGetMicros. 1018 * NOTE: All timestamps should be acquired from Dart_TimelineGetMicros.
1018 */ 1019 */
1019 DART_EXPORT Dart_Handle Dart_TimelineDuration(const char* label, 1020 DART_EXPORT void Dart_TimelineDuration(const char* label,
1020 int64_t start_micros, 1021 int64_t start_micros,
1021 int64_t end_micros); 1022 int64_t end_micros);
1022 1023
1023 1024
1024 /** 1025 /**
1025 * Add an instant timeline event to the embedder stream for the current isolate. 1026 * Add an instant timeline event to the embedder stream.
1026 * 1027 *
1027 * \param label The name of event. 1028 * \param label The name of event.
1028 * 1029 *
1029 * NOTE: All timestamps should be acquired from Dart_TimelineGetMicros. 1030 * NOTE: All timestamps should be acquired from Dart_TimelineGetMicros.
1030 */ 1031 */
1031 DART_EXPORT Dart_Handle Dart_TimelineInstant(const char* label); 1032 DART_EXPORT void Dart_TimelineInstant(const char* label);
1032 1033
1033 1034
1034 /** 1035 /**
1035 * Adds an asynchronous begin timeline event to the embedder stream for the 1036 * Adds an asynchronous begin timeline event to the embedder stream.
1036 * current isolate.
1037 * 1037 *
1038 * \param label The name of event. 1038 * \param label The name of event.
1039 * 1039 * \param async_id Pointer that receives the asynchronous id for this async
1040 * \return Returns an asynchronous id that must be passed to 1040 * operation. If it is less than 0 the event was not added to the timeline.
1041 * Dart_TimelineAsyncInstant and Dart_TimelineAsyncEnd. If the asynchronous
1042 * id is less than 0 the event was not added to the timeline and subsequent
1043 * calls to Dart_TimelineAsyncInstant and Dart_TimelineAsyncEnd will become
1044 * no-ops.
1045 * 1041 *
1046 * NOTE: All timestamps should be acquired from Dart_TimelineGetMicros. 1042 * NOTE: All timestamps should be acquired from Dart_TimelineGetMicros.
1047 */ 1043 */
1048 DART_EXPORT Dart_Handle Dart_TimelineAsyncBegin(const char* label, 1044 DART_EXPORT void Dart_TimelineAsyncBegin(const char* label,
1049 int64_t* async_id); 1045 int64_t* async_id);
1050 1046
1051 1047
1052 /** 1048 /**
1053 * Adds an asynchronous instant timeline event to the embedder stream for the 1049 * Adds an asynchronous instant timeline event to the embedder stream.
1054 * current isolate.
1055 * 1050 *
1056 * \param label The name of event. 1051 * \param label The name of event.
1057 * 1052 * \param async_id the asynchronous id received by Dart_TimelineAsyncBegin.
1058 * \return Returns an asynchronous id that must be passed to
1059 * Dart_TimelineAsyncInstant and Dart_TimelineAsyncEnd.
1060 * 1053 *
1061 * NOTE: All timestamps should be acquired from Dart_TimelineGetMicros. 1054 * NOTE: All timestamps should be acquired from Dart_TimelineGetMicros.
1062 */ 1055 */
1063 DART_EXPORT Dart_Handle Dart_TimelineAsyncInstant(const char* label, 1056 DART_EXPORT void Dart_TimelineAsyncInstant(const char* label,
1064 int64_t async_id); 1057 int64_t async_id);
1065 1058
1066 1059
1067 /** 1060 /**
1068 * Adds an asynchronous end timeline event to the embedder stream for the 1061 * Adds an asynchronous end timeline event to the embedder stream.
1069 * current isolate.
1070 * 1062 *
1071 * \param label The name of event. 1063 * \param label The name of event.
1072 * 1064 * \param async_id the asynchronous id received by Dart_TimelineAsyncBegin.
1073 * \return Returns an asynchronous id that must be passed to
1074 * Dart_TimelineAsyncInstant and Dart_TimelineAsyncEnd.
1075 * 1065 *
1076 * NOTE: All timestamps should be acquired from Dart_TimelineGetMicros. 1066 * NOTE: All timestamps should be acquired from Dart_TimelineGetMicros.
1077 */ 1067 */
1078 DART_EXPORT Dart_Handle Dart_TimelineAsyncEnd(const char* label, 1068 DART_EXPORT void Dart_TimelineAsyncEnd(const char* label,
1079 int64_t async_id); 1069 int64_t async_id);
1080 1070
1081 1071
1082 /** 1072 /**
1083 * Called by the VM to let the embedder know when to start recording into their 1073 * Called by the VM to let the embedder know when to start recording into the
1084 * own timeline implementation. Can be called from any thread. 1074 * timeline. Can be called from any thread.
1085 */ 1075 */
1086 typedef void (*Dart_EmbedderTimelineStartRecording)(); 1076 typedef void (*Dart_EmbedderTimelineStartRecording)();
1087 1077
1088 /** 1078 /**
1089 * Called by the VM to let the embedder know when to stop recording into their 1079 * Called by the VM to let the embedder know when to stop recording into the
1090 * own timeline implementation. Can be called from any thread. 1080 * timeline. Can be called from any thread.
1091 */ 1081 */
1092 typedef void (*Dart_EmbedderTimelineStopRecording)(); 1082 typedef void (*Dart_EmbedderTimelineStopRecording)();
1093 1083
1094 /** 1084 /**
1095 * Called by the VM to request data from the embedder's private timeline
1096 * implementation. Can be called from any thread and must complete
1097 * synchronously.
1098 *
1099 * \param stream_consumer The embedder must only call the stream_consumer with
1100 * the Dart_StreamConsumer_kData state. See Dart_StreamConsumer above.
1101 * \param user_data
1102 *
1103 * \return Returns true on success.
1104 *
1105 */
1106 typedef bool (*Dart_EmbedderTimelineGetTimeline)(
1107 Dart_StreamConsumer stream_consumer,
1108 void* user_data);
1109
1110
1111 /**
1112 * Sets the embedder timeline callbacks. These callbacks are used by the VM 1085 * Sets the embedder timeline callbacks. These callbacks are used by the VM
1113 * to notify the embedder of timeline recording state changes and to request 1086 * to notify the embedder of timeline recording state changes.
1114 * data from the embedder.
1115 * 1087 *
1116 * \param start_recording See Dart_EmbedderTimelineStartRecording. 1088 * \param start_recording See Dart_EmbedderTimelineStartRecording.
1117 * \param stop_recording See Dart_EmbedderTimelineStopRecording. 1089 * \param stop_recording See Dart_EmbedderTimelineStopRecording.
1118 * \param get_timeline See Dart_EmbedderTimelineGetTimeline.
1119 * 1090 *
1120 * NOTE: To avoid races, this should be called before Dart_Initialize. 1091 * NOTE: To avoid races, this should be called before Dart_Initialize.
1121 */ 1092 */
1122 DART_EXPORT void Dart_SetEmbedderTimelineCallbacks( 1093 DART_EXPORT void Dart_SetEmbedderTimelineCallbacks(
1123 Dart_EmbedderTimelineStartRecording start_recording, 1094 Dart_EmbedderTimelineStartRecording start_recording,
1124 Dart_EmbedderTimelineStopRecording stop_recording, 1095 Dart_EmbedderTimelineStopRecording stop_recording);
1125 Dart_EmbedderTimelineGetTimeline get_timeline);
1126 1096
1127 #endif // INCLUDE_DART_TOOLS_API_H_ 1097 #endif // INCLUDE_DART_TOOLS_API_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/lib/timeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698