You copied the Doc URL to your clipboard.

Adding string annotations to your code

String annotations work in a similar way to printf() statements but instead of console output, they populate the Log view and place framing overlays directly in the Timeline view.

To add string annotations to your code, follow these steps:


  1. Include streamline_annotate.h and streamline_annotate.c in your project.
    If you are working in Java, provides the same functionality as the macros in streamline_annotate.h for string, visual, and marker annotations, and for groups and channels.
  2. Add the ANNOTATE_SETUP macro to your code. You must call this before any other annotate macros.
  3. 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.
  4. Optional: Use ANNOTATE_END() to clear the annotation message for the thread.
  5. Ensure gatord is running.
  6. Run your application and exercise the area of the code that emits the annotations.

String annotations are displayed as text overlays inside the relevant channels in the details panel of the Timeline view, for example inside Channel 0 in the following screenshot. The letter A is displayed in the process list to indicate the presence of annotations. String annotations are also displayed in the Message column in the Log view.

Figure 8-2 String annotation overlays

String annotation overlays

Related concepts

Related reference