LCOV - code coverage report
Current view: top level - util/tile - fd_tile_private.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 1 1 100.0 %
Date: 2024-11-13 11:58:15 Functions: 0 0 -

          Line data    Source code
       1             : #ifndef HEADER_fd_src_util_tile_fd_tile_private_h
       2             : #define HEADER_fd_src_util_tile_fd_tile_private_h
       3             : 
       4             : #include "fd_tile.h"
       5             : 
       6             : /* fd_cpuset_t is an internal replacement for libc cpu_set_t.  It exists
       7             :    to work around stability issues working with the cpu_set_t API which
       8             :    is opaque, and in the case of musl libc, broken due to strict
       9             :    aliasing violations:
      10             : 
      11             :      error: dereferencing type-punned pointer might break strict-aliasing rules [-Werror=strict-aliasing]
      12             :      CPU_SET( args->cpu_idx, cpu_set );
      13             : 
      14             :    This API is intended for internal use within fd_tile.  Example usage:
      15             : 
      16             :      FD_CPUSET_DECL( cpuset );
      17             :      fd_cpuset_insert( cpuset, 2UL );
      18             : 
      19             :    See util/tmpl/fd_set.c for available methods.
      20             : 
      21             :    Safety notes:
      22             :    - DO NOT declare by fd_cpuset_t x; Instead use FD_CPUSET_DECL(x).
      23             :    - DO NOT use sizeof(fd_cpuset_t).  Instead use fd_cpuset_footprint(). */
      24             : 
      25             : #define SET_NAME fd_cpuset
      26             : #define SET_MAX FD_TILE_MAX
      27             : #include "../tmpl/fd_set.c"
      28             : 
      29             : /* FD_CPUSET_DECL declares an empty fd_cpuset_t with the given name in
      30             :    the current scope that is able to hold FD_TILE_MAX bits. */
      31             : 
      32        2649 : #define FD_CPUSET_DECL(name) fd_cpuset_t name [ fd_cpuset_word_cnt ] = {0}
      33             : 
      34             : FD_PROTOTYPES_BEGIN
      35             : 
      36             : /* fd_cpuset_{get,set}affinity wrap sched_{get,set}affinity for fd_tile
      37             :    internal use.  Serves to fix type-punning issues.  tid is the thread
      38             :    ID (pid_t).  tid==0 implies current thread.
      39             : 
      40             :    Note that fd_cpuset_getaffinity will silently truncate CPUs if the number
      41             :    of host CPUs exceeds FD_TILE_MAX.
      42             : 
      43             :    To set tile affinity, use the public fd_tile.h API.
      44             :    fd_sched_set_affinity can result in sub-optimal core/memory affinity,
      45             :    silent failures, and various other performance and stability issues. */
      46             : 
      47             : int
      48             : fd_cpuset_getaffinity( ulong         tid,
      49             :                        fd_cpuset_t * mask );
      50             : 
      51             : int
      52             : fd_cpuset_setaffinity( ulong               tid,
      53             :                        fd_cpuset_t const * mask );
      54             : 
      55             : /* These functions are for fd_tile internal use only. */
      56             : 
      57             : void *
      58             : fd_tile_private_stack_new( int   optimize,
      59             :                            ulong cpu_idx );
      60             : 
      61             : ulong
      62             : fd_tile_private_cpus_parse( char const * cstr,
      63             :                             ushort *     tile_to_cpu );
      64             : 
      65             : FD_PROTOTYPES_END
      66             : 
      67             : #endif /* HEADER_fd_src_util_tile_fd_tile_private_h */

Generated by: LCOV version 1.14