Previous: , Up: Data Collection reference   [Contents][Index]


4.5.4 Chronometer Reference

A chronometer is a specialization of a meter that measures time duration.

C Data Type: micro_benchmark_chronometer_provider { MICRO_BENCHMARK_CHRONO_PROVIDER_DEFAULT, MICRO_BENCHMARK_CHRONO_PROVIDER_TIME_T, MICRO_BENCHMARK_CHRONO_PROVIDER_CLOCK_T, MICRO_BENCHMARK_CHRONO_PROVIDER_GETTIMEOFDAY, MICRO_BENCHMARK_CHRONO_PROVIDER_CLOCK_GETTIME, MICRO_BENCHMARK_CHRONO_PROVIDER_USER_PROVIDED }

Chronometer type (see Predefined Chronometers.)


C Chronometer Function: micro_benchmark_meter micro_benchmark_chronometer_create_default ()

Preconditions:

  1. None.

Effects:

  1. Allocate and initialize a new chronometer.

Postconditions:

  1. The returned value meter is a valid chronometer.
  2. If micro_benchmark_chronometer_set_default was called, the type of the returned value is equivalent to the last value provided to that call.


C Chronometer Function: micro_benchmark_meter micro_benchmark_chronometer_create (micro_benchmark_clock_type clock_type, micro_benchmark_chronometer_provider provider)

Preconditions:

  1. clock_type is implemented by this system.
  2. provider is not equal to MICRO_BENCHMARK_CHRONO_PROVIDER_USER_PROVIDED.
  3. provider support is implemented by the library.
  4. clock_type is implemented by provider.

Effects:

  1. Allocate and initialize a new chronometer of type provider using the clock type clock_type.

Postconditions:

  1. The returned value is a valid chronometer.


C Chronometer Function: micro_benchmark_meter micro_benchmark_chronometer_from_meter (micro_benchmark_clock_type clock_type, micro_benchmark_meter base)

Preconditions:

  1. clock_type is implemented by this system.
  2. Either:
    • base points to a valid chronometer.
    • base points to an object of type micro_benchmark_meter_definition where at least all the function fields have been filled with a valid function.
    • clock_type is implemented by base.

Effects:

  1. Allocate a new chronometer ptr.
  2. Copy the data pointed by base to ptr.
  3. Initialize the allocated chronometer with micro_benchmark_stats_meter_init_with_data (ptr, clock_type)

Postconditions:

  1. The returned value is a valid chronometer.


C Chronometer Function: void micro_benchmark_chronometer_release (micro_benchmark_meter meter)

Preconditions:

  1. meter is a valid chronometer.

Effects:

  1. Cleanup and release meter.

Postconditions:

  1. The value meter is not valid.


C Chronometer Function: void micro_benchmark_chronometer_set_default (micro_benchmark_meter meter)

Preconditions:

  1. Either:
    • base points to a valid chronometer.
    • base points to an object of type micro_benchmark_meter_definition where at least all the field function fields have been filled with a valid function.

Effects:

  1. A copy of meter is stored.

Postconditions:

  1. The chronometers created providing the enumeration constant MICRO_BENCHMARK_CHRONO_PROVIDER_DEFAULT to micro_benchmark_chronometer_create will have the same effective type as the meter provided to the last call of this function.


C Chronometer Function: micro_benchmark_meter micro_benchmark_chronometer_get_default ()

Preconditions:

  1. None.

Effects:

  1. None.

Postconditions:

  1. The returned value is the effective type of the chronometers created providing the enumeration constant MICRO_BENCHMARK_CHRONO_PROVIDER_DEFAULT.
  2. If micro_benchmark_chronometer_set_default was called, the returned value is equivalent to the last value provided to that call.



Previous: Time Reference, Up: Data Collection reference   [Contents][Index]