Developer Guide

  • 2021.2
  • 06/11/2021
  • Public
Contents

Measurement Library Helpers

The behavior of the measurement library collector is controlled through environment variables as described in Control Data Collection. The measurement library contains a set of helper functions to simplify operations with these environment settings.
  • Extract the history buffer size from the environment variable: Call
    tcc_measurement_get_buffer_size_from_env()
    and specify the measurement name. The return value contains the buffer size, which you can use in your monitoring application to access the shared memory buffer:
    uint64_t buffer_size = tcc_measurement_get_buffer_size_from_env(measurement_name); tcc_measurement_buffer_init(buffer_size, measurement_name, &buffer);
  • Extract the maximum tolerable latency (deadline) for the measurement from the environment variable: Call
    tcc_measurement_get_deadline_from_env()
    and specify the measurement name. The return value contains the deadline, which you can use in your real-time application or monitoring application to set up deadline violation handling. Call
    tcc_measurement_get_time_unit_from_env()
    to extract the time unit to convert the deadline value into CPU clock cycles.
    uint64_t deadline_raw = tcc_measurement_get_deadline_from_env( measurement_name); TCC_TIME_UNIT time_unit = tcc_measurement_get_time_unit_from_env(); uint64_t deadline = tcc_measurement_convert_time_units_to_clock(deadline_raw, time_unit); if (deadline!=0 && value > deadline) { printf("Latency exceeding deadline: %lu CPU cycles (%ld %s)\n", value, tcc_measurement_convert_clock_to_time_units(value, time_unit), tcc_measurement_get_string_from_time_unit(time_unit)); }
  • Convert
    TCC_TIME_UNIT
    enum to string name: Call
    tcc_measurement_get_string_from_time_unit()
    and specify the value from the
    TCC_TIME_UNIT
    enumeration to get a string representation. (Example above.)
  • Convert the string name of the time unit to
    TCC_TIME_UNIT
    enum: Call
    tcc_measurement_get_time_unit_from_string()
    and specify the string with the time unit. The return value contains the value from the
    TCC_TIME_UNIT
    enumeration.
    TCC_TIME_UNIT time_unit = tcc_measurement_get_time_unit_from_string( units_str); if (time_unit == TCC_TU_UNKNOWN) { printf("Unknown time unit\n"); return 0; } deadline = tcc_measurement_convert_time_units_to_clock(deadline, time_unit);

Product and Performance Information

1

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