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 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
903 /** | 903 /** |
904 * Start recording timeline events for the current isolate. | 904 * Start recording timeline events for the current isolate. |
905 * | 905 * |
906 * \param stream_mask A bitmask of streams that should be recorded. | 906 * \param stream_mask A bitmask of streams that should be recorded. |
907 * | 907 * |
908 * NOTE: Calling with 0 disables recording of all streams. | 908 * NOTE: Calling with 0 disables recording of all streams. |
909 */ | 909 */ |
910 DART_EXPORT void Dart_TimelineSetRecordedStreams(int64_t stream_mask); | 910 DART_EXPORT void Dart_TimelineSetRecordedStreams(int64_t stream_mask); |
911 | 911 |
912 /** | 912 /** |
913 * A stream consumer callback function. | |
914 * | |
915 * This function will be called repeatedly until there is no more data in a | |
916 * stream. | |
siva
2015/08/11 16:54:33
Should this be:
until there is no more data in a s
Cutch
2015/08/11 17:08:56
Done.
| |
917 * | |
918 * \param state Indicates a new stream, data, or a finished stream. | |
919 * \param stream_name A name for this stream. Not guaranteed to be meaningful. | |
920 * \param buffer A pointer to data from the stream. | |
siva
2015/08/11 16:54:33
"A pointer to the stream data" maybe?
Cutch
2015/08/11 17:08:56
Done.
| |
921 * \param buffer_length The number of bytes at buffer that should be consumed. | |
922 * \param user_data The user data pointer passed in when requesting the stream. | |
siva
2015/08/11 16:54:33
instead of user_data maybe name it stream_callback
Cutch
2015/08/11 17:08:56
Done.
| |
923 * | |
924 * At the start of each stream state will be DART_STREAM_CONSUMER_STATE_START | |
925 * and buffer will be NULL. | |
926 * | |
927 * For each chunk of data the state will be DART_STREAM_CONSUMER_STATE_DATA | |
928 * and buffer will not be NULL. | |
929 * | |
930 * At the end of each stream state will be DART_STREAM_CONSUMER_STATE_FINISH | |
931 * and buffer will be NULL. | |
932 */ | |
933 typedef void (*Dart_StreamConsumer)( | |
934 intptr_t state, | |
siva
2015/08/11 16:54:33
Dart_StreamConsumer_State state,
(see below).
Cutch
2015/08/11 17:08:56
Done.
| |
935 const char* stream_name, | |
936 uint8_t* buffer, | |
937 intptr_t buffer_length, | |
938 void* user_data); | |
939 | |
940 /** Indicates a new stream is being output */ | |
941 #define DART_STREAM_CONSUMER_STATE_START 0 | |
942 /** Data for the current stream */ | |
943 #define DART_STREAM_CONSUMER_STATE_DATA 1 | |
944 /** Indicates stream is finished */ | |
945 #define DART_STREAM_CONSUMER_STATE_FINISH 2 | |
siva
2015/08/11 16:54:33
why not use a enum here:
typedef enum {
Dart_St
Cutch
2015/08/11 17:08:56
Done.
| |
946 | |
947 /** | |
913 * Get the timeline for the current isolate in trace-event format | 948 * Get the timeline for the current isolate in trace-event format |
914 * | 949 * |
915 * \param output The address of the trace buffer output | 950 * \param consumer A Dart_StreamConsumer. |
916 * \param output_length The length of the trace buffer output | 951 * \param user_data User data passed into consumer. |
917 * | |
918 * NOTE: output is allocated in the C heap and must be freed by the caller. | |
919 * | 952 * |
920 * NOTE: The trace-event format is documented here: https://goo.gl/hDZw5M | 953 * NOTE: The trace-event format is documented here: https://goo.gl/hDZw5M |
921 * | 954 * |
922 * \return True if a trace was output. The outputted trace may be empty. | 955 * \return True if a stream was output. |
923 */ | 956 */ |
924 DART_EXPORT bool Dart_TimelineGetTrace(const char** output, | 957 DART_EXPORT bool Dart_TimelineGetTrace(Dart_StreamConsumer consumer, |
925 intptr_t* output_length); | 958 void* user_data); |
926 | 959 |
927 /** | 960 /** |
928 * Add a duration timeline event to the embedder stream for the current isolate. | 961 * Add a duration timeline event to the embedder stream for the current isolate. |
929 * | 962 * |
930 * \param label The name of the event. | 963 * \param label The name of the event. |
931 * \param start_micros The start of the duration (in microseconds) | 964 * \param start_micros The start of the duration (in microseconds) |
932 * \param end_micros The end of the duration (in microseconds) | 965 * \param end_micros The end of the duration (in microseconds) |
933 * | 966 * |
934 * NOTE: On Posix platforms you should use gettimeofday and on Windows platforms | 967 * NOTE: On Posix platforms you should use gettimeofday and on Windows platforms |
935 * you should use GetSystemTimeAsFileTime to get the time values. | 968 * you should use GetSystemTimeAsFileTime to get the time values. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
994 * \return Returns an asynchronous id that must be passed to | 1027 * \return Returns an asynchronous id that must be passed to |
995 * Dart_TimelineAsyncInstant and Dart_TimelineAsyncEnd. | 1028 * Dart_TimelineAsyncInstant and Dart_TimelineAsyncEnd. |
996 * | 1029 * |
997 * NOTE: On Posix platforms this call uses gettimeofday and on Windows platforms | 1030 * NOTE: On Posix platforms this call uses gettimeofday and on Windows platforms |
998 * this call uses GetSystemTimeAsFileTime to get the current time. | 1031 * this call uses GetSystemTimeAsFileTime to get the current time. |
999 */ | 1032 */ |
1000 DART_EXPORT Dart_Handle Dart_TimelineAsyncEnd(const char* label, | 1033 DART_EXPORT Dart_Handle Dart_TimelineAsyncEnd(const char* label, |
1001 int64_t async_id); | 1034 int64_t async_id); |
1002 | 1035 |
1003 #endif // INCLUDE_DART_TOOLS_API_H_ | 1036 #endif // INCLUDE_DART_TOOLS_API_H_ |
OLD | NEW |