Ignore:
Timestamp:
Oct 4, 2018, 11:50:21 PM (3 years ago)
Author:
alain
Message:

Complete restructuration of kernel locks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/syscalls/sys_fork.c

    r506 r566  
    4040#include <syscalls.h>
    4141
    42 //////////////
     42////////////////////
    4343int sys_fork( void )
    4444{
     
    6767    parent_cxy         = local_cxy;
    6868
     69#if (DEBUG_SYS_FORK || CONFIG_INSTRUMENTATION_SYSCALLS)
     70uint64_t     tm_start = hal_get_cycles();
     71#endif
     72
    6973#if DEBUG_SYS_FORK
    70 uint64_t          tm_start;
    71 uint64_t          tm_end;
    72 tm_start = hal_get_cycles();
    7374if( DEBUG_SYS_FORK < tm_start )
    7475printk("\n[DBG] %s : thread %x in process %x enter / cycle =  %d\n",
     
    8788
    8889#if DEBUG_SYSCALLS_ERROR
    89 printk("\n[ERROR] in %s : too much children processes\n", __FUNCTION__);
     90printk("\n[ERROR] in %s : thread %x in process %x cannot fork : too much children\n",
     91__FUNCTION__, parent_thread_ptr->trdid, parent_pid );
    9092#endif
    9193            hal_remote_atomic_add ( children_xp , -1 );
     
    134136
    135137#if DEBUG_SYSCALLS_ERROR
    136 printk("\n[ERROR] in %s : cannot fork process %x in cluster %x\n",
    137 __FUNCTION__, parent_pid, local_cxy );
     138printk("\n[ERROR] in %s : thread %x in process %x cannot fork to cluster %x\n",
     139__FUNCTION__, parent_thread_ptr->trdid, parent_pid, local_cxy );
    138140#endif
    139141        parent_thread_ptr->errno = EAGAIN;
     
    159161    thread_t * current = CURRENT_THREAD;
    160162
     163#if (DEBUG_SYS_FORK || CONFIG_INSTRUMENTATION_SYSCALLS)
     164uint64_t     tm_end = hal_get_cycles();
     165#endif
     166
     167#if DEBUG_SYS_FORK
     168if( DEBUG_SYS_FORK < tm_end )
     169printk("\n[DBG] %s : thread %x in process %x exit / cycle %d\n",
     170__FUNCTION__, current->trdid, current->process->pid, (uint32_t)tm_end );
     171#endif
     172
    161173    if( (current == parent_thread_ptr) && (local_cxy == parent_cxy) )   // parent thread
    162174    {
     
    164176        thread_unblock( XPTR( child_cxy , child_thread_ptr ) , THREAD_BLOCKED_GLOBAL );
    165177
    166 #if DEBUG_SYS_FORK
    167 tm_end = hal_get_cycles();
    168 if( DEBUG_SYS_FORK < tm_end )
    169 printk("\n[DBG] %s : process %x exit / cost = %d / cycle %d\n",
    170 __FUNCTION__, parent_pid, (uint32_t)(tm_end - tm_start), (uint32_t)tm_end );
     178        // only parent contribute to instrumentation
     179
     180#if CONFIG_INSTRUMENTATION_SYSCALLS
     181hal_atomic_add( &syscalls_cumul_cost[SYS_FORK] , tm_end - tm_start );
     182hal_atomic_add( &syscalls_occurences[SYS_FORK] , 1 );
    171183#endif
    172184        return child_pid;
     
    174186        else                                                               // child_thread
    175187    {
    176 
    177 #if DEBUG_SYS_FORK
    178 tm_end = hal_get_cycles();
    179 if( DEBUG_SYS_FORK < tm_end )
    180 printk("\n[DBG] %s : process %x exit / cost = %d / cycle %d\n",
    181 __FUNCTION__, child_pid, (uint32_t)(tm_end - tm_start), (uint32_t)tm_end );
    182 #endif
    183188        return 0;
    184189    }
Note: See TracChangeset for help on using the changeset viewer.