Porting Guide (libbenchmark)

From liblfds.org
Revision as of 17:06, 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


To permit libbenchmark 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 one header and two C files, thus;

        │   └───libbenchmark
        │       └───libbenchmark_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.


#define LIBBENCHMARK_PAL_TIME_UNITS_PER_SECOND( pointer_to_time_units_per_second )
#define LIBBENCHMARK_PAL_GET_HIGHRES_TIME( pointer_to_time )

Additionally, in this file, include any needed OS provided header files.


int libbenchmark_pal_populate_topology( struct libbenchmark_topology_state *ts,
                                        struct libshared_memory_state *ms );


void libbenchmark_pal_print_string( char const * const string );

See Also