Developer Guide

  • 2021.2
  • 06/11/2021
  • Public
Contents

Monitor Measurements Only

You can run the measurement monitoring sample to monitor measurements collected from the single measurement sample (
tcc_single_measurement_sample
).
In this mode, the monitoring sample starts first and waits for the single measurement sample to start. After the single measurement sample starts, the monitoring sample attaches to the shared memory buffer and starts reading the latency data that
tcc_single_measurement_sample
placed there. The monitoring sample prints the latency of each workload iteration. 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
tcc_single_measurement_sample
.
The monitoring sample monitors the specified measurement instances from
tcc_single_measurement_sample
. 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. For more information about instrumenting your code with measurement library APIs, see Instrument the Code.
To run this example:
  1. From your host system, open two terminal windows. In the first window, you will start running the monitoring sample per the next steps. Then, in the second window, you will run the single measurement sample as input into the monitoring sample.
  2. In the first terminal window, connect to the target system:
    ssh <user>@<target>
  3. In the SSH session, run the monitoring sample and leave it running. The sample will wait for you to start the single measurement sample in the next step.
    TCC_MEASUREMENTS_BUFFERS=Approximation:10 TCC_MEASUREMENTS_TIME_UNIT=ns tcc_measurement_monitoring_sample
    where:
    Argument
    Description
    TCC_MEASUREMENTS_BUFFERS=Approximation:10
    This environment variable specifies the measurement instance to collect:
    • “Approximation” is the measurement name defined in the
      __itt_string_handle_create
      call in the
      tcc_single_measurement_sample
      .
    • “10” is the maximum number of measurements that can be stored for this measurement instance.
    For more information about this environment variable, see Control Data Collection.
    TCC_MEASUREMENTS_TIME_UNIT=ns
    Print measured latencies in nanoseconds.
    For more information about this environment variable, see Control Data Collection.
  4. In the second terminal window, connect to the target system:
    ssh <user>@<target>
  5. Start the single measurement sample:
    TCC_MEASUREMENTS_BUFFERS=Approximation:10 TCC_USE_SHARED_MEMORY=true tcc_single_measurement_sample --approximation 20 --iterations 10
    where:
    Argument
    Description
    TCC_MEASUREMENTS_BUFFERS=Approximation:10
    This environment variable matches the environment set in the
    tcc_measurement_monitoring_sample
    command.
    TCC_USE_SHARED_MEMORY=true
    Use a shared memory ring buffer instead of a local buffer to store all measurement results.
    tcc_single_measurement_sample --approximation 20 --iterations 10
    The sample will calculate the 20th approximation of 2/pi and run 10 times.
    For more information about these command-line options, see Command-Line Options.
  6. Go back to the first terminal. You should see that the monitoring sample is printing the latency measurements of the single measurement sample.
Output Example
This sample prints profiling results of the profiled application.
The profiling output includes the following:
  • Informational message with monitoring settings (measurement instance name and maximum number of measurements that can be stored)
  • List of measurement results
  • Summary:
    • Total number of measurements
Initializing monitoring for "Approximation", buffer size 10 Approximation: 627 CPU cycles (223 ns) Approximation: 527 CPU cycles (187 ns) Approximation: 574 CPU cycles (204 ns) Approximation: 531 CPU cycles (189 ns) Approximation: 537 CPU cycles (191 ns) Approximation: 533 CPU cycles (190 ns) Approximation: 535 CPU cycles (190 ns) Approximation: 537 CPU cycles (191 ns) Approximation: 537 CPU cycles (191 ns) Approximation: 538 CPU cycles (191 ns) Count of read data: 10 Finishing monitoring
To learn more about the environment variables used in this sample, see Control Data Collection.

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.