You copied the Doc URL to your clipboard.

Adding Streamline Annotate to your code

Streamline provides a set of macros that enable you to send customized output to your generated Analysis Reports. This feature, called Annotate, is much more versatile than printf() statements, and you can use it to add overlays or automatic bookmarks to the Timeline view.

Note

In version 5.20 and later, applications that use user space gator, in addition to those that use kernel space gator, can emit annotations. Applications built using the annotation implementation in earlier versions of DS-5 will continue to work in version 5.20 and later, but only with kernel space gator. If they use user space gator, you must re-build them using the new annotation implementation, following the steps described in this topic.

To start using the Annotate feature, follow these steps:

Procedure

  1. Ensure gatord is running.
  2. Include the streamline_annotate.h header file and streamline_annotate.c in your project. If you are working in Java, StreamlineAnnotate.java provides the same functionality as the macros in streamline_annotate.h.
  3. Add the ANNOTATE_SETUP macro to your code. It must be called before any other annotate macros.
  4. Add one ANNOTATE_DEFINE macro to your code.
  5. Add annotations to your code using the macros defined in streamline_annotate.h. For example, write a null-terminated string from any thread and set its color using the ANNOTATE_COLOR(color, string) macro. Either choose a color constant from those defined in streamline_annotate.h or send the ASCII escape code followed by a 3-byte RGB value.
  6. Optional: Use ANNOTATE_END to clear the annotation message for the thread.
  7. Compile and link your code using the -pthread option.

Related concepts

Related reference

Was this page helpful? Yes No