Porting Guide (benchmark)

From liblfds.org
Revision as of 17:07, 30 May 2016 by Admin (talk | contribs) (→‎The Porting Abstraction Layer)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Introduction

To permit benchmark to work on a range of platforms a porting abstraction layer has been written. Porting simply involves implementing the porting abstraction layer; the library will then compile and work. Implementation involves providing values to a small set defines, macros and typedefs and implementing one or two functions.

The Porting Abstraction Layer

The porting abstraction layer consists of two C and one header files, thus;

└───test_and_benchmark
    └───benchmark
        └───src
            ├───porting_abstraction_layer_numa_free.c
            ├───porting_abstraction_layer_numa_malloc.c
            └───porting_abstraction_layer_operating_system.h

Accordingly, to add a new platform, introduce a new #ifdef, which matches the appropriate compiler defined macros for your platform.

The NUMA free/malloc functions only need to be implemented on NUMA systems. On SMP systems, a hosted implementation is assumed, and malloc is used.

porting_abstraction_layer_numa_free.c

void benchmark_pal_numa_free( void *memory, lfds710_pal_uint_t size_in_bytes );

porting_abstraction_layer_numa_malloc.c

void benchmark_pal_numa_malloc( lfds710_pal_uint_t numa_node_id, lfds710_pal_uint_t size_in_bytes );

porting_abstraction_layer_operating_system.h

#define BENCHMARK_PAL_OS_STRING
#define BENCHMARK_PAL_MEMORY_TYPE
#define BENCHMARK_PAL_MEMORY_TYPE_STRING

See Also