Developer Guide

  • 2021.2
  • 06/11/2021
  • Public

About the Sample

To pinpoint the latency source in an application, you may need to measure not only the entire real-time cycle but also stages within it. You can add measurement library APIs to each of these parts of your code.
The multiple measurements sample (
) illustrates how to instrument code with measurement library APIs. You can copy and modify the source code to instrument your real-time application.
This sample runs a workload consisting of two parts:
  • One part is the multiplication of two matrices. Matrices in this sample are square, and you can set their size.
  • The other part calculates the Nth approximation of the number 2 / pi. You can set the parameter N, an increase in N leads to an increase in the accuracy of the approximation.
The sample measures the execution time of each part, as well as the total execution time of both parts combined.
This sample represents an arbitrary computation workload that might be executed as part of a real-time control loop, such as computation of a robotic arm’s next position. The computation itself and the result are not relevant for this demonstration.
The sample also represents a use case in which an application is instrumented with measurement library APIs and the data generated from the application is intended to be analyzed by a separate profiling application. The sample does not print latency data but the data can be viewed when it is run with the Measurement Analysis Sample.


This sample demonstrates the use of the following functions:
  1. ittnotify:
    • __itt_domain_create(domain_name)
      - Create ITT domain.
    • __itt_string_handle_create(measurement_name)
      - Create ITT task handle.
    • __itt_task_begin(domain, __itt_null, __itt_null, measurement)
      - Collect the measurement start time based on the CPU’s timestamp counter (TSC).
    • __itt_task_end(domain)
      - Collect the measurement end time based on the TSC and calculate the difference between the start and end times to get the latency measurement.
The sample has the following flow:
  1. The sample starts by defining the ITT domain and the task handle.
  2. When all the required variables are initialized, the sample runs the
    function which starts two workloads:
    • The first workload executes matrices multiplication.
    • The second workload calculates the Nth approximation of the 2/pi number.
  3. The sample measures the overall latency for both workloads and the latencies for each workload.

Product and Performance Information


Performance varies by use, configuration and other factors. Learn more at