Up: Timer Reference   [Contents][Index]


4.6.1 Timer Provider Reference

C Data Type: micro_benchmark_timer_provider { MICRO_BENCHMARK_TIMER_PROVIDER_DEFAULT, MICRO_BENCHMARK_TIMER_PROVIDER_ITIMER, MICRO_BENCHMARK_TIMER_PROVIDER_TIMER_T, MICRO_BENCHMARK_TIMER_PROVIDER_TIMERFD, MICRO_BENCHMARK_TIMER_PROVIDER_FROM_METER, MICRO_BENCHMARK_TIMER_PROVIDER_USER_PROVIDED }

Timer type (see Predefined Timers.)


C Timer Function: micro_benchmark_timer micro_benchmark_timer_create_default ()

Preconditions:

  1. None.

Effects:

  1. Allocate and initialize a new timer of the default type.

Postconditions:

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


C Timer Function: micro_benchmark_timer micro_benchmark_timer_create (micro_benchmark_clock_type clock_type, micro_benchmark_timer_provider provider)

Preconditions:

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

Effects:

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

Postconditions:

  1. The returned value is a valid timer.


C Timer Function: micro_benchmark_timer micro_benchmark_timer_from_meter (micro_benchmark_clock_type clock_type, micro_benchmark_chronometer_provider chrono_provider)

Preconditions:

  1. clock_type is implemented by this system.
  2. chrono_provider is implemented by this system.

Effects:

  1. Allocate a new chronometer adapter ptr of type chrono_provider.
  2. Initialize the allocated timer.

Postconditions:

  1. The returned value is a valid chronometer.


C Timer Function: micro_benchmark_timer micro_benchmark_timer_from_provided_meter (micro_benchmark_clock_type clock_type, micro_benchmark_meter chrono_base)

Preconditions:

  1. clock_type is implemented by this system.
  2. Either:
    • chrono_base points to a valid chronometer.
    • chrono_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 chrono_base.

Effects:

  1. Allocate a new chronometer adapter ptr with the same type as base.
  2. Initialize the allocated timer.

Postconditions:

  1. The returned value is a valid chronometer.


C Timer Function: micro_benchmark_timer micro_benchmark_timer_from_template (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 timer.
    • base points to an object of type micro_benchmark_timer_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 timer ptr.
  2. Copy base contents to ptr.
  3. Initialize ptr

Postconditions:

  1. The returned value is a valid chronometer.


C Timer Function: void micro_benchmark_timer_release (micro_benchmark_timer timer)

Preconditions:

  1. timer is a valid timer.

Effects:

  1. Cleanup and release timer.

Postconditions:

  1. The value timer is not valid.



Up: Timer Reference   [Contents][Index]