Developer Guide

  • 2021.1
  • 11/03/2021
  • Public

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
    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
    and specify the measurement name. The return value contains the deadline, which you can use in your workload or monitoring application to set up deadline violation handling. Call
    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
    enum to string name: Call
    and specify the value from the
    enumeration to get a string representation. (Example above.)
  • Convert the string name of the time unit to
    enum: Call
    and specify the string with the time unit. The return value contains the value from the
    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


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