Changeset 594 for trunk/kernel/syscalls/sys_close.c
- Timestamp:
- Nov 10, 2018, 2:33:26 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/syscalls/sys_close.c
r506 r594 41 41 process_t * process = this->process; 42 42 43 #if (DEBUG_SYS_CLOSE || CONFIG_INSTRUMENTATION_SYSCALLS) 44 uint64_t tm_start = hal_get_cycles(); 45 #endif 46 43 47 #if DEBUG_SYS_CLOSE 44 uint32_t tm_start;45 uint32_t tm_end;46 tm_start = hal_get_cycles();47 48 if( DEBUG_SYS_CLOSE < tm_start ) 48 printk("\n[ DBG] %s : thread %x in process %xenter / fdid %d / cycle %d\n",49 __FUNCTION__, this->trdid, process->pid, file_id, (uint32_t)tm_start );49 printk("\n[%s] thread[%x,%x] enter / fdid %d / cycle %d\n", 50 __FUNCTION__, process->pid, this->trdid, file_id, (uint32_t)tm_start ); 50 51 #endif 51 52 … … 64 65 if( file_xp == XPTR_NULL ) 65 66 { 66 printk("\n[ERROR] in %s : undefined file descriptor = %d\n", 67 __FUNCTION__ , file_id ); 68 this->errno = EBADFD; 67 68 #if DEBUG_SYSCALLS_ERROR 69 printk("\n[ERROR] in %s : undefined file descriptor %d\n", 70 __FUNCTION__ , file_id ); 71 #endif 72 this->errno = EBADFD; 69 73 return -1; 70 74 } … … 75 79 if( error ) 76 80 { 77 printk("\n[ERROR] in %s : cannot close file descriptor = %d\n", 78 __FUNCTION__ , file_id ); 81 82 #if DEBUG_SYSCALLS_ERROR 83 printk("\n[ERROR] in %s : cannot close file descriptor %d\n", 84 __FUNCTION__ , file_id ); 85 #endif 79 86 this->errno = error; 80 87 return -1; … … 83 90 hal_fence(); 84 91 92 #if (DEBUG_SYS_CLOSE || CONFIG_INSTRUMENTATION_SYSCALLS) 93 uint64_t tm_end = hal_get_cycles(); 94 #endif 95 85 96 #if DEBUG_SYS_CLOSE 86 97 tm_end = hal_get_cycles(); 87 98 if( DEBUG_SYS_CLOSE < tm_start ) 88 printk("\n[ DBG] %s : thread %x in process %x exit / cost %d/ cycle %d\n",89 __FUNCTION__, this->trdid, process->pid, (uint32_t)(tm_end - tm_start), (uint32_t)tm_start);99 printk("\n[%s] thread[%x,%x] exit / cycle %d\n", 100 __FUNCTION__, process->pid, this->trdid, (uint32_t)tm_end ); 90 101 #endif 91 102 103 #if CONFIG_INSTRUMENTATION_SYSCALLS 104 hal_atomic_add( &syscalls_cumul_cost[SYS_CLOSE] , tm_end - tm_start ); 105 hal_atomic_add( &syscalls_occurences[SYS_CLOSE] , 1 ); 106 #endif 107 92 108 return 0; 93 109 }
Note: See TracChangeset
for help on using the changeset viewer.