LCOV - code coverage report
Current view: top level - util - fd_util.c (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 15 27 55.6 %
Date: 2025-08-05 05:04:49 Functions: 4 5 80.0 %

          Line data    Source code
       1             : #define _GNU_SOURCE
       2             : #include "fd_util.h"
       3             : 
       4             : void
       5             : fd_boot( int *    pargc,
       6        2409 :          char *** pargv ) {
       7             :   /* At this point, we are immediately after the program start, there is
       8             :      only one thread of execution and fd has not yet been booted. */
       9        2409 :   fd_log_private_boot  ( pargc, pargv );
      10        2409 :   fd_shmem_private_boot( pargc, pargv );
      11        2409 :   fd_tile_private_boot ( pargc, pargv ); /* The caller is now tile 0 */
      12        2409 : }
      13             : 
      14             : void
      15        1275 : fd_halt( void ) {
      16             :   /* At this point, we are immediately before normal program
      17             :      termination, and fd has already been booted. */
      18        1275 :   fd_tile_private_halt ();
      19        1275 :   fd_shmem_private_halt();
      20        1275 :   fd_log_private_halt  ();
      21        1275 : }
      22             : 
      23             : long
      24      923587 : _fd_tickcount( void const * _ ) {
      25      923587 :   (void)_;
      26      923587 :   return fd_tickcount();
      27      923587 : }
      28             : 
      29             : #if FD_HAS_HOSTED
      30             : 
      31             : #include <poll.h>
      32             : #include <sched.h>
      33             : #include <time.h>
      34             : 
      35       21453 : void fd_yield( void ) { sched_yield(); }
      36             : 
      37             : int
      38             : fd_syscall_poll( struct pollfd * fds,
      39             :                  uint            nfds,
      40           0 :                  int             timeout ) {
      41           0 : #if defined(__linux__)
      42           0 :   if( timeout<0 ) {
      43           0 :     return ppoll( fds, nfds, NULL, NULL );
      44           0 :   } else {
      45           0 :     struct timespec ts = {
      46           0 :       .tv_sec  = (long)( timeout/1000 ),
      47           0 :       .tv_nsec = (long)((timeout%1000)*1000000),
      48           0 :     };
      49           0 :     return ppoll( fds, nfds, &ts, NULL );
      50           0 :   }
      51             : #else
      52             :   return poll( fds, nfds, timeout );
      53             : #endif
      54           0 : }
      55             : 
      56             : #endif

Generated by: LCOV version 1.14