Ignore:
Timestamp:
Nov 10, 2018, 2:33:26 PM (5 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_close.c

    r506 r594  
    4141        process_t * process = this->process;
    4242
     43#if (DEBUG_SYS_CLOSE || CONFIG_INSTRUMENTATION_SYSCALLS)
     44uint64_t     tm_start = hal_get_cycles();
     45#endif
     46
    4347#if DEBUG_SYS_CLOSE
    44 uint32_t     tm_start;
    45 uint32_t     tm_end;
    46 tm_start = hal_get_cycles();
    4748if( DEBUG_SYS_CLOSE < tm_start )
    48 printk("\n[DBG] %s : thread %x in process %x enter / fdid %d / cycle %d\n",
    49 __FUNCTION__, this->trdid, process->pid, file_id, (uint32_t)tm_start );
     49printk("\n[%s] thread[%x,%x] enter / fdid %d / cycle %d\n",
     50__FUNCTION__, process->pid, this->trdid, file_id, (uint32_t)tm_start );
    5051#endif
    5152 
     
    6465    if( file_xp == XPTR_NULL )
    6566    {
    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
     69printk("\n[ERROR] in %s : undefined file descriptor %d\n",
     70__FUNCTION__ , file_id );
     71#endif
     72        this->errno = EBADFD;
    6973                return -1;
    7074    }
     
    7579        if( error )
    7680        {
    77         printk("\n[ERROR] in %s : cannot close file descriptor = %d\n",
    78                __FUNCTION__ , file_id );
     81
     82#if DEBUG_SYSCALLS_ERROR
     83printk("\n[ERROR] in %s : cannot close file descriptor %d\n",
     84__FUNCTION__ , file_id );
     85#endif
    7986                this->errno = error;
    8087                return -1;
     
    8390        hal_fence();
    8491
     92#if (DEBUG_SYS_CLOSE || CONFIG_INSTRUMENTATION_SYSCALLS)
     93uint64_t     tm_end = hal_get_cycles();
     94#endif
     95
    8596#if DEBUG_SYS_CLOSE
    8697tm_end = hal_get_cycles();
    8798if( 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 );
     99printk("\n[%s] thread[%x,%x] exit / cycle %d\n",
     100__FUNCTION__, process->pid, this->trdid, (uint32_t)tm_end );
    90101#endif
    91102 
     103#if CONFIG_INSTRUMENTATION_SYSCALLS
     104hal_atomic_add( &syscalls_cumul_cost[SYS_CLOSE] , tm_end - tm_start );
     105hal_atomic_add( &syscalls_occurences[SYS_CLOSE] , 1 );
     106#endif
     107
    92108        return 0;
    93109}
Note: See TracChangeset for help on using the changeset viewer.