Developer Guide

  • 2021.3
  • 11/18/2021
  • Public

Monitor Multiple Measurement Instances

If your application has multiple measurement instances, you can monitor all of them in one report to compare latency measurements.
You can run the measurement analysis sample to monitor latency measurements collected from a real-time application during application run. The real-time application must be instrumented with measurement library APIs.
In this mode, the analysis sample runs the instrumented application, attaches to the shared memory buffer, and starts reading the latency data that the instrumented application placed there. The sample prints each latency measurement at the moment when it was read. After the application is finished, the analysis sample also stops. This type of analysis is called “stream monitoring.” This means that the results are constantly read from the shared memory buffer where they are placed by the instrumented application.
The analysis sample monitors the specified measurement instances from the real-time application. A
measurement instance
refers to the measurement library APIs that you have added to your application to measure the latency of the real-time cycle or any part of it. An application can have multiple measurement instances, each one tracking a different stage of the cycle, for example, input, compute, and output. For more information about instrumenting your code with measurement library APIs, see Instrument the Code.
The following example monitors data collected from the multiple measurements sample (
Command Example
To run this example:
  1. From your host system, connect to the target system:
    ssh <user>@<target>
  2. In the SSH session
    , run the sample:
    tcc_measurement_analysis_sample monitor "Multiplication:5,Approximation:5,Cycle:5" -time-units us -- tcc_multiple_measurements_sample --approximation 10000 --multiplication 100 --iterations 5
This argument specifies the measurement instances to collect. Each measurement instance is separated by a comma.
  • “Multiplication”, “Approximation” and “Cycle” are the measurement names defined in the
    call in the
  • “5” is the buffer size – the maximum number of measurements that can be stored for this measurement instance. The size matches the number of iterations specified in the
    command. To ensure all measurement results are stored, update the buffer size if you change the number of iterations when running the sample.
This argument has the same format as the
environment variable. See Control Data Collection.
-time-units us
The output will display results in microseconds.
Separates the measurement analysis sample command from the real-time application command. For more information about the command-line options of
, see Command-Line Options.
Output Example
The sample prints the output of the profiled application and the profiling results.
The profiling output includes the following:
  • Table of all measurement results. The analysis sample prints each measurement to the console immediately after it reads it from the shared buffer. Each row represents one measurement with the name of the corresponding measurement instance.
  • Summary for each measurement instance:
    • Count of read data: Number of measurements that the analysis sample read from the shared memory buffer
MONITORING OUTPUT: ---------------------------------- Name Latency(us) ---------------------------------- Multiplication 3437 Approximation 147 Cycle 3586 Multiplication 3345 Approximation 150 Cycle 3497 Multiplication 3326 Approximation 146 Cycle 3474 Multiplication 3267 Approximation 137 Cycle 3405 Multiplication 3226 Approximation 137 Cycle 3364 [Multiplication] Count of read data: 5 [Approximation] Count of read data: 5 [Cycle] Count of read data: 5 ------------------------------ APPLICATION OUTPUT: Running with arguments: approximation = 10000, multiplication = 100, iterations = 5 Running workloads. This may take a while, depending on iteration values. Workloads were run successfully.
The sample reads measurement buffers concurrently. As a result, the order of measurement instances in the output may differ from the actual execution order.

Buffer Size Influence

Internally, the measurement analysis sample runs the instrumented application with the
environment variable, so that measured values are stored in a ring buffer in shared memory. The instrumented application writes values to the shared memory, and the measurement analysis sample reads them from the shared memory.
If the buffer size (for example, Multiplication:5) is bigger than or equal to the number of iterations, the measurement analysis sample will read all values.
If the buffer size is smaller than the number of iterations, the count of read data may vary. The count may match the number of iterations in cases where the measurement analysis sample can read the data at about the same pace as the instrumented application writes the data. Otherwise, the count may be lower if the instrumented application writes values faster than the measurement analysis sample can read them. In this case, the instrumented application stops writing new values to the buffer until the measurement analysis sample reads the values from the buffer. While the application is waiting, the new values are dropped.

Product and Performance Information


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