Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset acf37bc in mainline


Ignore:
Timestamp:
2009-05-15T20:22:26Z (13 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master
Children:
687246b
Parents:
40a0e504
Message:

Reduce Udebug overhead with some nifty tricks.

Location:
kernel/generic/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/syscall/syscall.c

    r40a0e504 racf37bc  
    6060{
    6161        unative_t rc;
     62
     63#ifdef CONFIG_UDEBUG
     64        bool debug;
     65
     66        /*
     67         * Early check for undebugged tasks. We do not lock anything as this
     68         * test need not be precise in either way.
     69         */
     70        debug = THREAD->udebug.active;
    6271       
    63 #ifdef CONFIG_UDEBUG
    64         udebug_syscall_event(a1, a2, a3, a4, a5, a6, id, 0, false);
     72        if (debug) {
     73                udebug_syscall_event(a1, a2, a3, a4, a5, a6, id, 0, false);
     74        }
    6575#endif
    6676       
     
    7787       
    7888#ifdef CONFIG_UDEBUG
    79         udebug_syscall_event(a1, a2, a3, a4, a5, a6, id, rc, true);
     89        if (debug) {
     90                udebug_syscall_event(a1, a2, a3, a4, a5, a6, id, rc, true);
    8091       
    81         /*
    82          * Stopping point needed for tasks that only invoke non-blocking
    83          * system calls.
    84          */
    85         udebug_stoppable_begin();
    86         udebug_stoppable_end();
     92                /*
     93                 * Stopping point needed for tasks that only invoke
     94                 * non-blocking system calls. Not needed if the task
     95                 * is not being debugged (it cannot block here).
     96                 */
     97                udebug_stoppable_begin();
     98                udebug_stoppable_end();
     99        }
    87100#endif
    88101       
  • kernel/generic/src/udebug/udebug.c

    r40a0e504 racf37bc  
    9999}
    100100
    101 /** Do a preliminary check that a debugging session is in progress.
    102  *
    103  * This only requires the THREAD->udebug.lock mutex (and not TASK->udebug.lock
    104  * mutex). For an undebugged task, this will never block (while there could be
    105  * collisions by different threads on the TASK mutex), thus improving SMP
    106  * perormance for undebugged tasks.
    107  *
    108  * @return      True if the thread was in a debugging session when the function
    109  *              checked, false otherwise.
    110  */
    111 static bool udebug_thread_precheck(void)
    112 {
    113         bool res;
    114 
    115         mutex_lock(&THREAD->udebug.lock);
    116         res = THREAD->udebug.active;
    117         mutex_unlock(&THREAD->udebug.lock);
    118 
    119         return res;
    120 }
    121 
    122101/** Start of stoppable section.
    123102 *
     
    245224
    246225        etype = end_variant ? UDEBUG_EVENT_SYSCALL_E : UDEBUG_EVENT_SYSCALL_B;
    247 
    248         /* Early check for undebugged tasks */
    249         if (!udebug_thread_precheck()) {
    250                 return;
    251         }
    252226
    253227        mutex_lock(&TASK->udebug.lock);
Note: See TracChangeset for help on using the changeset viewer.