Ignore:
Timestamp:
Nov 10, 2018, 2:33:26 PM (3 years ago)
Author:
alain
Message:

Fix various bugs in sys_stat() and sys_mmap() functions.
Improve debug in other functions.

File:
1 edited

Legend:

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

    r566 r594  
    4747    process_t    * process  = this->process;
    4848
    49 #if DEBUG_SYS_OPEN
    50 uint32_t     tm_start;
    51 uint32_t     tm_end;
    52 tm_start = hal_get_cycles();
     49#if (DEBUG_SYS_OPEN || CONFIG_INSTRUMENTATION_SYSCALLS)
     50uint64_t     tm_start = hal_get_cycles();
    5351#endif
    54  
     52
    5553    // check fd_array not full
    5654    if( process_fd_array_full() )
     
    8179#if DEBUG_SYS_OPEN
    8280if( DEBUG_SYS_OPEN < tm_start )
    83 printk("\n[DBG] %s : thread %x in process %x enter / path %s / flags %x / cycle %d\n",
    84 __FUNCTION__, this->trdid, process->pid, kbuf, flags, (uint32_t)tm_start );
     81printk("\n[%s] thread[%x,%x] enter for <%s> / flags %x / cycle %d\n",
     82__FUNCTION__, process->pid, this->trdid, kbuf, flags, (uint32_t)tm_start );
    8583#endif
    8684 
     
    112110    }
    113111
     112    hal_fence;
     113
     114#if (DEBUG_SYS_OPEN || CONFIG_INSTRUMENTATION_SYSCALLS)
     115uint64_t     tm_end = hal_get_cycles();
     116#endif
     117
    114118#if DEBUG_SYS_OPEN
    115 tm_end = hal_get_cycles();
    116119if( DEBUG_SYS_OPEN < tm_start )
    117 printk("\n[DBG] %s : thread %x in process %x exit / cost %d / cycle %d\n",
    118 __FUNCTION__, this->trdid, process->pid, (uint32_t)(tm_end - tm_start), (uint32_t)tm_start );
     120printk("\n[%s] thread[%x,%x] exit for <%s> / cycle %d\n",
     121__FUNCTION__, process->pid, this->trdid, kbuf, (uint32_t)tm_end );
    119122#endif
    120123 
     124#if CONFIG_INSTRUMENTATION_SYSCALLS
     125hal_atomic_add( &syscalls_cumul_cost[SYS_OPEN] , tm_end - tm_start );
     126hal_atomic_add( &syscalls_occurences[SYS_OPEN] , 1 );
     127#endif
     128
    121129    return file_id;
    122130}
Note: See TracChangeset for help on using the changeset viewer.