NAME | SYNOPSIS | FEATURES | DESCRIPTION | ATTRIBUTES | SEE ALSO
#include <perf/chBench.h>KnError sysTimerStartPeriodic(KnTimeVal * period, TimerTickHandler handler, void * cookie);
PERF
The system timer management services are provided by the microkernel to share the system timer with the application. They are intended mainly for benchmarking and profiling.
Typically, bench programs require free running timers and profiling handlers require to be invoked periodically.
sysTimerStartPeriodic must be issued to share the system timer between the system and the application. This starts the timer in periodic mode.
The sysTimerStartPeriodic is restricted to SUPERVISOR actors.
In case of failure, an error code is returned as described below:
The system timer is already in use by another application.
The given period KnTimeVal *period specified an illegal nanosecond value: lesser than 0 or greater than 1,000,000,000, or a non zero seconds value.
KnTimeVal *period points to an illegal address.
The timer can't be initialized with the required period.
The handler is called as an interrupt handler and therefore the handler implementation must be restricted to the API allowed at interrupt level. The handler is invoked passing cookie as the only argument.
sysTimerStartFreerun disconnects the system periodic timer. This starts the timer in freerun mode. The minperiod specifies the minimum period required for the free-run timer. The implementation is free to program the timer with any period higher than the required one.
In case of failure, an error code is returned as described below:
The system timer is already shared by another application.
The timer can't be initialized with the required interval.
The sysTimerReadCounter routine returns the current value of the timer counter. The value can be used to measure the elapsed time between two calls to the read_counter routine. Invocation of this call without a previous call to share the system timer returns an undocumented value.
sysTimerGetCounterPeriod returns the difference between the maximum and minimum values of the timer counter. The routine may be called when the timer operates in any mode. The get_counter_period routine may be called from interrupt level. Invocation of this call without a previous call to share the system timer returns an undocumented value.
sysTimerGetCounterFrequency returns the frequency of the timer counter in Hz. The routine may be called when the timer is operating in any mode. The get_counter_frequency routine may be called from interrupt level.
Invocation of the above three calls without a previous call to sysTimerStartPeriodic or sysTimerStartFreerun returns an undocumented value.
sysTimerStop returns the timer to the system. The timer is reprogrammed to the system frequency.
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
---|---|
Interface Stability | Evolving |
NAME | SYNOPSIS | FEATURES | DESCRIPTION | ATTRIBUTES | SEE ALSO