Changeset 566 for trunk/kernel/syscalls/sys_fork.c
- Timestamp:
- Oct 4, 2018, 11:50:21 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/syscalls/sys_fork.c
r506 r566 40 40 #include <syscalls.h> 41 41 42 ////////////// 42 //////////////////// 43 43 int sys_fork( void ) 44 44 { … … 67 67 parent_cxy = local_cxy; 68 68 69 #if (DEBUG_SYS_FORK || CONFIG_INSTRUMENTATION_SYSCALLS) 70 uint64_t tm_start = hal_get_cycles(); 71 #endif 72 69 73 #if DEBUG_SYS_FORK 70 uint64_t tm_start;71 uint64_t tm_end;72 tm_start = hal_get_cycles();73 74 if( DEBUG_SYS_FORK < tm_start ) 74 75 printk("\n[DBG] %s : thread %x in process %x enter / cycle = %d\n", … … 87 88 88 89 #if DEBUG_SYSCALLS_ERROR 89 printk("\n[ERROR] in %s : too much children processes\n", __FUNCTION__); 90 printk("\n[ERROR] in %s : thread %x in process %x cannot fork : too much children\n", 91 __FUNCTION__, parent_thread_ptr->trdid, parent_pid ); 90 92 #endif 91 93 hal_remote_atomic_add ( children_xp , -1 ); … … 134 136 135 137 #if DEBUG_SYSCALLS_ERROR 136 printk("\n[ERROR] in %s : cannot fork process %x incluster %x\n",137 __FUNCTION__, parent_ pid, local_cxy );138 printk("\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 ); 138 140 #endif 139 141 parent_thread_ptr->errno = EAGAIN; … … 159 161 thread_t * current = CURRENT_THREAD; 160 162 163 #if (DEBUG_SYS_FORK || CONFIG_INSTRUMENTATION_SYSCALLS) 164 uint64_t tm_end = hal_get_cycles(); 165 #endif 166 167 #if DEBUG_SYS_FORK 168 if( DEBUG_SYS_FORK < tm_end ) 169 printk("\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 161 173 if( (current == parent_thread_ptr) && (local_cxy == parent_cxy) ) // parent thread 162 174 { … … 164 176 thread_unblock( XPTR( child_cxy , child_thread_ptr ) , THREAD_BLOCKED_GLOBAL ); 165 177 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 181 hal_atomic_add( &syscalls_cumul_cost[SYS_FORK] , tm_end - tm_start ); 182 hal_atomic_add( &syscalls_occurences[SYS_FORK] , 1 ); 171 183 #endif 172 184 return child_pid; … … 174 186 else // child_thread 175 187 { 176 177 #if DEBUG_SYS_FORK178 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 #endif183 188 return 0; 184 189 }
Note: See TracChangeset
for help on using the changeset viewer.