Ignore:
Timestamp:
Oct 10, 2018, 3:11:53 PM (2 years ago)
Author:
alain
Message:

1) Improve the busylock debug infrastructure.
2) introduce a non-distributed, but portable implementation for the pthread_barrier.

File:
1 edited

Legend:

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

    r508 r581  
    3131#include <remote_barrier.h>
    3232
     33#if DEBUG_SYS_BARRIER
     34//////////////////////////////////////////////////////
     35static char * sys_barrier_op_str( uint32_t operation )
     36{
     37        if     ( operation == BARRIER_INIT    ) return "INIT";
     38        else if( operation == BARRIER_DESTROY ) return "DESTROY";
     39        else if( operation == BARRIER_WAIT    ) return "WAIT";
     40        else                                    return "undefined";
     41}
     42#endif
     43
    3344//////////////////////////////////
    3445int sys_barrier( void     * vaddr,
     
    4152    thread_t   * this    = CURRENT_THREAD;
    4253    process_t  * process = this->process;
     54
     55#if DEBUG_SYS_BARRIER
     56uint64_t   tm_start;
     57uint64_t   tm_end;
     58tm_start = hal_get_cycles();
     59if( DEBUG_SYS_BARRIER < tm_start )
     60printk("\n[DBG] %s : thread %x in process %x enter for %s / count %d / cycle %d\n",
     61__FUNCTION__, this->trdid, process->pid, sys_barrier_op_str(operation), count,
     62(uint32_t)tm_start );
     63#endif
    4364
    4465    // check vaddr in user vspace
     
    125146        }  // end switch
    126147
     148#if DEBUG_SYS_BARRIER
     149tm_end = hal_get_cycles();
     150if( DEBUG_SYS_BARRIER < tm_end )
     151printk("\n[DBG] %s : thread %x in process %x exit for %s / cost %d / cycle %d\n",
     152__FUNCTION__, this->trdid, process->pid, sys_barrier_op_str(operation),
     153(uint32_t)(tm_end - tm_start), (uint32_t)tm_end );
     154#endif
     155
    127156        return 0;
    128157
Note: See TracChangeset for help on using the changeset viewer.