# core_portme.c

Summary

core_portme.c |
portable_malloc | Provide malloc() functionality in a platform specific way.
portable_free | Provide free() functionality in a platform specific way.
TIMER_RES_DIVIDER | Divider to trade off timer resolution and total time that can be measured.
start_time | This function will be called right before starting the timed portion of the benchmark.
stop_time | This function will be called right after ending the timed portion of the benchmark.
get_time | Return an abstract “ticks” number that signifies time on the system.
time_in_secs | Convert the value returned by get_time to seconds.
portable_init | Target specific initialization code Test for some common mistakes.
portable_fini | Target specific final code
core_start_parallel | Start benchmarking in a parallel context.
core_stop_parallel | Stop a parallel context execution of coremark, and gather the results.

### portable_malloc

> void *portable_malloc( | size_t | size | )

Provide malloc() functionality in a platform specific way.

### portable_free

> void portable_free( | void | * | p | )

Provide free() functionality in a platform specific way.

### TIMER_RES_DIVIDER

Divider to trade off timer resolution and total time that can be measured.

Use lower values to increase resolution, but make sure that overflow does not occur. If there are issues with the return value overflowing, increase this value.

### start_time

> void start_time( | void | )

This function will be called right before starting the timed portion of the benchmark.

Implementation may be capturing a system timer (as implemented in the example code) or zeroing some system parameters - e.g. setting the cpu clocks cycles to 0.

### stop_time

> void stop_time( | void | )

This function will be called right after ending the timed portion of the benchmark.

Implementation may be capturing a system timer (as implemented in the example code) or other system parameters - e.g. reading the current value of cpu cycles counter.

### get_time

> CORE_TICKS get_time( | void | )

Return an abstract “ticks” number that signifies time on the system.

Actual value returned may be cpu cycles, milliseconds or any other value, as long as it can be converted to seconds by time_in_secs. This methodology is taken to accomodate any hardware or simulated platform. The sample implementation returns millisecs by default, and the resolution is controlled by TIMER_RES_DIVIDER

### time_in_secs

> secs_ret time_in_secs( | CORE_TICKS | ticks | )

Convert the value returned by get_time to seconds.

The secs_ret type is used to accomodate systems with no support for floating point. Default implementation implemented by the EE_TICKS_PER_SEC macro above.

### portable_init

> void portable_init( | core_portable | * | p,
> | int | * | argc,
> | char | * | argv[] | )

Target specific initialization code Test for some common mistakes.

### portable_fini

> void portable_fini( | core_portable | * | p | )

Target specific final code

### core_start_parallel

Start benchmarking in a parallel context.

Three implementations are provided, one using pthreads, one using fork and shared mem, and one using fork and sockets. Other implementations using MCAPI or other standards can easily be devised.

### core_stop_parallel

Stop a parallel context execution of coremark, and gather the results.

Three implementations are provided, one using pthreads, one using fork and shared mem, and one using fork and sockets. Other implementations using MCAPI or other standards can easily be devised.

> void *portable_malloc( | size_t | size | )

Provide malloc() functionality in a platform specific way.

> void portable_free( | void | * | p | )

Provide free() functionality in a platform specific way.

> void start_time( | void | )

This function will be called right before starting the timed portion of the benchmark.

> void stop_time( | void | )

This function will be called right after ending the timed portion of the benchmark.

> CORE_TICKS get_time( | void | )

Return an abstract “ticks” number that signifies time on the system.

> secs_ret time_in_secs( | CORE_TICKS | ticks | )

Convert the value returned by get_time to seconds.

> void portable_init( | core_portable | * | p,
> | int | * | argc,
> | char | * | argv[] | )

Target specific initialization code Test for some common mistakes.

> void portable_fini( | core_portable | * | p | )

Target specific final code
Divider to trade off timer resolution and total time that can be measured.
For machines that have floating point support, get number of seconds as a double.
Close