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:
- None.
Effects:
- Allocate and initialize a new chronometer.
Postconditions:
- The returned value meter is a valid chronometer.
- 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:
- clock_type is implemented by this system.
- provider is not equal to
MICRO_BENCHMARK_CHRONO_PROVIDER_USER_PROVIDED
.
- provider support is implemented by the library.
- clock_type is implemented by provider.
Effects:
- Allocate and initialize a new chronometer of type provider using
the clock type clock_type.
Postconditions:
- 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:
- clock_type is implemented by this system.
- 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:
- Allocate a new chronometer ptr.
- Copy the data pointed by base to ptr.
- Initialize the allocated chronometer with
micro_benchmark_stats_meter_init_with_data (ptr,
clock_type)
Postconditions:
- The returned value is a valid chronometer.
- C Chronometer Function: void micro_benchmark_chronometer_release (micro_benchmark_meter meter) ¶
-
Preconditions:
- meter is a valid chronometer.
Effects:
- Cleanup and release meter.
Postconditions:
- The value meter is not valid.
- C Chronometer Function: void micro_benchmark_chronometer_set_default (micro_benchmark_meter meter) ¶
-
Preconditions:
- 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:
- A copy of meter is stored.
Postconditions:
- 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:
- None.
Effects:
- None.
Postconditions:
- The returned value is the effective type of the chronometers created
providing the enumeration constant
MICRO_BENCHMARK_CHRONO_PROVIDER_DEFAULT
.
- If
micro_benchmark_chronometer_set_default
was called, the
returned value is equivalent to the last value provided to that call.