CPU

CPU — Check the capabilities of the current CPU

Synopsis




unsigned int oil_cpu_get_flags              (void);
void        oil_cpu_fault_check_enable      (void);
void        oil_cpu_fault_check_disable     (void);
int         oil_cpu_fault_check_try         (void (*func) (void *),
                                             void *priv);
double      oil_cpu_get_ticks_per_second    (void);

Description

Details

oil_cpu_get_flags ()

unsigned int oil_cpu_get_flags              (void);

Returns a bitmask containing the available CPU features.

Returns : the CPU features.

oil_cpu_fault_check_enable ()

void        oil_cpu_fault_check_enable      (void);

Enables fault checking mode. This function may be called multiple times. Each call to this function must be paired with a corresponding call to oil_cpu_fault_check_disable().

This function sets a signal handler for SIGILL.


oil_cpu_fault_check_disable ()

void        oil_cpu_fault_check_disable     (void);

Disables fault checking mode. See oil_cpu_fault_check_enable() for details.


oil_cpu_fault_check_try ()

int         oil_cpu_fault_check_try         (void (*func) (void *),
                                             void *priv);

Calls to this function must be preceded by a call to oil_cpu_fault_check_enable() to enable fault checking mode. This function sets up recovery information and then calls the function func with the parameter priv. If func or any other functions it calls attempt to execute an illegal instruction, the exception will be caught and recovered from.

func : the function to attempt
priv : a value to pass to the function
Returns : 1 if the function was executed sucessfully, 0 if the function attempted to execute an illegal instruction.

oil_cpu_get_ticks_per_second ()

double      oil_cpu_get_ticks_per_second    (void);

Returns the estimated number of ticks per second. This feature is currently unimplemented.

This function may take several milliseconds or more to execute in order to calculate a good estimate of the number of ticks (as measured by the profiling functions) per second. Note that the number of ticks per second is often dependent on the CPU frequency, which can change dynamically. Thus the value returned by this function may be incorrect as soon as it is returned.

Returns : a double