Difference between pages "r7.1.1:Building Guide (test)" and "r7.1.1:Function libbenchmark misc pal helper add logical processor node to topology tree"

From liblfds.org
(Difference between pages)
Jump to navigation Jump to search
m (1 revision imported)
 
m (1 revision imported)
 
Line 1: Line 1:
{{DISPLAYTITLE:Building Guide (test)}}
{{DISPLAYTITLE:function libbenchmark_misc_pal_helper_new_topology_node}}
==Introducton==
==Source Files==
The ''test'' binary is a thin command line veneer which provides convenient access to the test functionality in ''libtest''. The binary depends on ''liblfds711'', ''libtest'' and ''libshared''.
└───test_and_benchmark
    └───libbenchmark
        ├───inc
        │  └───libbenchmark
        │          libbenchmark_porting_abstraction_layer.h
        └───src
            └───libbenchmark_misc
                    libbenchmark_misc_pal_helpers.c


The ''test'' library uses a porting abstraction layer to mask platform differences. Building ''test'' requires build files (makefile, etc) for your toolchain (GCC, gnumake, etc) and a port of the abstraction layer to your platform.
==Opaque Structures==
struct [[r7.1.1:struct libbenchmark_topology_state|libbenchmark_topology_state]];


A small number of popular toolchains are supported out-of-the-box, along with porting abstraction layers which cover Windows (user-mode) and Linux (user-mode).
==Prototype==
void libbenchmark_misc_pal_helper_add_logical_processor_node_to_topology_tree( struct libbenchmark_topology_state *ts,
                                                                                lfds711_pal_uint_t logical_processor_number,
                                                                                enum flag windows_processor_group_inuse_flag,
                                                                                lfds711_pal_uint_t windows_processor_group_number );


==Supported Toolchains==
==Parameters==
The supported toolchains are;
''struct libbenchmark_topology_state *ts''
: A pointer a ''struct libbenchmark_topology'' obtained from ''libbenchmark_pal_populate_topology''.


* GCC and gnumake
''lfds711_pal_uint_t logical_processor_number''
* MSVC and gnumake (yes, gnumake, not nmake)
: The logical processor number of the logical processor to add to the topology tree pointed to by ''ts''.


Note that in 7.1.1, Visual Studio solution files are not provided.  This is because there are over ''liblfds'' and the ''benchmark'' and ''benchmark'' libraries and programmes (seven projects in all) in the end due to the multple build variants (debug, release, library, DLL, kernel library, kernel DLL, and repeated twice, once for VS2012 and once for VS2013) what comes to something like ten thousand settings, all of which have to be set using a mouse and a GUI, which is not only extraordinarily time-consuming and error-prone, but emotionally agonizing.
''enum flag windows_processor_group_inuse_flag''
: An ''enum flag'' which indicates whether or not the ''windows_processor_group_number'' argument contains a valid value (for that field is only meaningful on Windows 7 and greater).


Mac support is not available due to lack of access to a Mac.
''lfds711_pal_uint_t windows_processor_group_number''
: The Windows processor group number of the logical processor to add to the topology tree pointed to by ''ts''.  This value is only meaningful on Windows 7 and greater.  It will only be used if the ''windows_processor_group_inuse_flag'' is set to ''RAISED'', and so if not used, can be set to any value.  Zero is as good a choice as any other.


==Directory Structure==
==Return Value==
└── test_and_benchmark
No return value.
    └── test                  : test command line veneer
        ├── bin              : output directory - the binary ends up here
        ├── build            : build configuration directory - contains one directory per platform
        │  ├── gcc_gnumake  : GCC, gnumake, hosted implementation
        │  └── msvc_gnumake  : Microsoft Visual C (command line compiler) and gnumake
        ├── obj              : temporary directory for object files
        └── src              : the source files


==Building==
==Example==
The library directory tree contains at its top level directory called ''build''.


This directory contains one directory per supported toolchain, where each such directory contains the files necessary to build for that toolchain.  Detailed descriptions of how to build for each toolchain are given below, with one heading per toolchain.
==Notes==
 
This helper function is used by ''libbenchmark_pal_populate_topology'' to add a logical processor node to the topology tree.
The ''test'' binary depends on ''liblfds711'', ''libtest'' and ''libshared''.  The ''test'' build files are harcoded with relative paths to find the output from these libraries, so these libraries do not need to be installed.
 
On all platforms, you need to clean between changing build types (debug, release, static, dynamic, profiled, etc), as there is only one directory used to hold object files.
 
==Per-Toolchain Build Instructions==
 
===GCC and gnumake===
└── test_and_benchmark
    └── test
        └── build
            └── gcc_gnumake
                    Makefile
 
To build, install GCC and gnumake, enter the build directory and type;
 
make
 
The following targets are available;
 
cov    : coverage
dbg    : debug
prof    : profiling
rel    : release
tsan    : thread sanitizer
vanilla : no specific-build arguments
clean  : what you'd expect
 
When switching from one target to another, ''clean'' must be made.
 
If building ''*_ar_tsan'', ''libtsan'' must be installed.  This is not necessary if building ''*_so_tsan''.
 
If building for ARM32 with shared object versions of the ''liblfds'' libraries, linking will fail, with the error ''"/usr/bin/ld: ../../bin/test: hidden symbol `__aeabi_uidiv' in /usr/lib/gcc/arm-linux-gnueabihf/4.9/libgcc.a(_udivsi3.o) is referenced by DSO"''.  This means something has attempted to divide a 64 bit value by a 64 bit value, an operation which apparently is costly and usually unnecessary, a 32 bit divisor apparently is normally adequate, and as such is intentionally caught in a link-breaking way.
 
Unfortunately, as far as can be determined, ''liblfds'' itself is not performing this operation - and as such, it is not obvious how to fix it.
 
===MSVC and gnumake===
└── test_and_benchmark
    └── test
        └── build
            └── msvc_gnumake
                    makefile
 
To build, install an MSVC command line compiler, enter the build directory and type;
 
make
 
The following targets are available;
 
dlldbg  : debug  (with ''liblfds'' libs built as DLLs)
dllrel  : release (with ''liblfds'' libs built as DLLs)
libdbg  : debug  (with ''liblfds'' libs built as libs)
librel  : release (with ''liblfds'' libs built as libs)
clean  : what you'd expect
 
When switching from one target to another, clean must be made.


==See Also==
==See Also==
* [[r7.1.1:Building Guide (testing)|Building Guide (testing)]]
* [[r7.1.1:Porting Guide (libbenchmark)|Porting Guide (libbenchmark)]]
* ''[[r7.1.1:function libbenchmark_pal_populate_topology|libbenchmark_pal_populate_topology]]''

Latest revision as of 20:16, 17 February 2017

Source Files

└───test_and_benchmark
    └───libbenchmark
        ├───inc
        │   └───libbenchmark
        │           libbenchmark_porting_abstraction_layer.h
        └───src
            └───libbenchmark_misc
                    libbenchmark_misc_pal_helpers.c

Opaque Structures

struct libbenchmark_topology_state;

Prototype

void libbenchmark_misc_pal_helper_add_logical_processor_node_to_topology_tree( struct libbenchmark_topology_state *ts,
                                                                               lfds711_pal_uint_t logical_processor_number,
                                                                               enum flag windows_processor_group_inuse_flag,
                                                                               lfds711_pal_uint_t windows_processor_group_number );

Parameters

struct libbenchmark_topology_state *ts

A pointer a struct libbenchmark_topology obtained from libbenchmark_pal_populate_topology.

lfds711_pal_uint_t logical_processor_number

The logical processor number of the logical processor to add to the topology tree pointed to by ts.

enum flag windows_processor_group_inuse_flag

An enum flag which indicates whether or not the windows_processor_group_number argument contains a valid value (for that field is only meaningful on Windows 7 and greater).

lfds711_pal_uint_t windows_processor_group_number

The Windows processor group number of the logical processor to add to the topology tree pointed to by ts. This value is only meaningful on Windows 7 and greater. It will only be used if the windows_processor_group_inuse_flag is set to RAISED, and so if not used, can be set to any value. Zero is as good a choice as any other.

Return Value

No return value.

Example

Notes

This helper function is used by libbenchmark_pal_populate_topology to add a logical processor node to the topology tree.

See Also