Mercurial > nand-ecoscentric
changeset 3003:918ae79235a2
* include/instrmnt.h: Add instrumentation macros for event flags and
the bitmap scheduler.
* include/instrument_desc.h: Regenerate.
* src/sync/flag.cxx, src/sched/bitmap.cxx: Add instrumentation.
* cdl/instrument.cdl: Add CYGDBG_KERNEL_INSTRUMENT_FLAG and
CYGDBG_KERNEL_INSTRUMENT_BITMAP options.
| author | jld |
|---|---|
| date | Fri, 29 Jan 2010 15:06:38 +0000 |
| parents | d6c0c0e0431c |
| children | 22d29d9d2cec |
| files | packages/kernel/current/ChangeLog packages/kernel/current/cdl/instrument.cdl packages/kernel/current/include/instrmnt.h packages/kernel/current/include/instrument_desc.h packages/kernel/current/src/sched/bitmap.cxx packages/kernel/current/src/sync/flag.cxx |
| diffstat | 6 files changed, 145 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/packages/kernel/current/ChangeLog +++ b/packages/kernel/current/ChangeLog @@ -1,3 +1,12 @@ +2010-01-27 John Dallaway <john@dallaway.org.uk> + + * include/instrmnt.h: Add instrumentation macros for event flags and + the bitmap scheduler. + * include/instrument_desc.h: Regenerate. + * src/sync/flag.cxx, src/sched/bitmap.cxx: Add instrumentation. + * cdl/instrument.cdl: Add CYGDBG_KERNEL_INSTRUMENT_FLAG and + CYGDBG_KERNEL_INSTRUMENT_BITMAP options. + 2009-10-04 John Dallaway <john@dallaway.org.uk> * cdl/instrument.cdl: Add CYGDBG_KERNEL_INSTRUMENT_MLQ option. Issue @@ -4756,7 +4765,7 @@ Wed Mar 11 13:18:17 GMT 1998 Chris Prov // ####GPLCOPYRIGHTBEGIN#### // ------------------------------------------- // This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2009 Free Software Foundation, Inc. +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2009, 2010 Free Software Foundation, Inc. // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by
--- a/packages/kernel/current/cdl/instrument.cdl +++ b/packages/kernel/current/cdl/instrument.cdl @@ -8,7 +8,7 @@ ## ####ECOSGPLCOPYRIGHTBEGIN#### ## ------------------------------------------- ## This file is part of eCos, the Embedded Configurable Operating System. -## Copyright (C) 1998, 1999, 2000, 2001, 2002, 2009 Free Software Foundation, Inc. +## Copyright (C) 1998, 1999, 2000, 2001, 2002, 2009, 2010 Free Software Foundation, Inc. ## ## eCos is free software; you can redistribute it and/or modify it under ## the terms of the GNU General Public License as published by the Free @@ -63,7 +63,7 @@ cdl_option CYGVAR_KERNEL_INSTRUMENT_EXTE } cdl_option CYGNUM_KERNEL_INSTRUMENT_BUFFER_SIZE { - display "Size of instrumentation buffer size" + display "Instrumentation buffer size" flavor data legal_values 16 to 0x100000 default_value 256 @@ -77,7 +77,7 @@ cdl_option CYGNUM_KERNEL_INSTRUMENT_BUFF } cdl_option CYGDBG_KERNEL_INSTRUMENT_BUFFER_WRAP { - display "Wrap instrument buffer" + display "Wrap instrumentation buffer" default_value 1 description " When the instrumentation buffer is full it can either be restarted @@ -103,7 +103,7 @@ cdl_option CYGDBG_KERNEL_INSTRUMENT_FLAG } cdl_option CYGDBG_KERNEL_INSTRUMENT_SCHED { - display "Instrument the scheduler" + display "Instrument common scheduler operations" default_value 1 active_if CYGPKG_KERNEL_SCHED description " @@ -129,7 +129,7 @@ cdl_option CYGDBG_KERNEL_INSTRUMENT_THRE } cdl_option CYGDBG_KERNEL_INSTRUMENT_INTR { - display "Instrument interrupts" + display "Instrument interrupt-related operations" default_value 1 active_if CYGPKG_KERNEL_INTERRUPTS description " @@ -206,6 +206,19 @@ cdl_option CYGDBG_KERNEL_INSTRUMENT_MBOX the message box code." } +cdl_option CYGDBG_KERNEL_INSTRUMENT_FLAG { + display "Instrument event flag operations" + default_value 1 + active_if CYGPKG_KERNEL_SYNCH + description " + It is possible to perform selective instrumentation at + run-time. It is also possible to disable instrumentation + in various kernel components at compile-time, thus + reducing the code size overheads. This option controls + whether or not instrumentation support is compiled into + the event flag code." +} + cdl_option CYGDBG_KERNEL_INSTRUMENT_CLOCK { display "Instrument clock operations" default_value 1 @@ -258,6 +271,19 @@ cdl_option CYGDBG_KERNEL_INSTRUMENT_MLQ the code for the multi-level queue scheduler." } +cdl_option CYGDBG_KERNEL_INSTRUMENT_BITMAP { + display "Instrument bitmap scheduler operations" + default_value 1 + active_if CYGSEM_KERNEL_SCHED_BITMAP + description " + It is possible to perform selective instrumentation at + run-time. It is also possible to disable instrumentation + in various kernel components at compile-time, thus + reducing the code size overheads. This option controls + whether or not instrumentation support is compiled into + the code for the bitmap scheduler." +} + cdl_option CYGDBG_KERNEL_INSTRUMENT_USER { display "Support application-level instrumentation" default_value 1 @@ -271,7 +297,7 @@ cdl_option CYGDBG_KERNEL_INSTRUMENT_USER } cdl_component CYGDBG_KERNEL_INSTRUMENT_MSGS { - display "Print user friendly instrument messages" + display "Provide user-friendly instrumentation messages" default_value 1 description " Include code which will convert the instrument type field
--- a/packages/kernel/current/include/instrmnt.h +++ b/packages/kernel/current/include/instrmnt.h @@ -11,7 +11,7 @@ // ####ECOSGPLCOPYRIGHTBEGIN#### // ------------------------------------------- // This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2010 Free Software Foundation, Inc. // // eCos is free software; you can redistribute it and/or modify it under // the terms of the GNU General Public License as published by the Free @@ -120,6 +120,8 @@ externC char * cyg_instrument_msg(CYG_WO #define CYG_INSTRUMENT_CLASS_MBOXT 0x0a00 #define CYG_INSTRUMENT_CLASS_SMP 0x0b00 #define CYG_INSTRUMENT_CLASS_MLQ 0x0c00 +#define CYG_INSTRUMENT_CLASS_FLAG 0x0d00 +#define CYG_INSTRUMENT_CLASS_BITMAP 0x0e00 #define CYG_INSTRUMENT_CLASS_USER 0x0f00 @@ -244,6 +246,24 @@ externC char * cyg_instrument_msg(CYG_WO #define CYG_INSTRUMENT_EVENT_MLQ_DEQUEUE 8 #define CYG_INSTRUMENT_EVENT_MLQ_REMOVE 9 +// Flag events + +#define CYG_INSTRUMENT_EVENT_FLAG_WAIT 1 +#define CYG_INSTRUMENT_EVENT_FLAG_WOKE 2 +#define CYG_INSTRUMENT_EVENT_FLAG_SETBITS 3 +#define CYG_INSTRUMENT_EVENT_FLAG_MASKBITS 4 +#define CYG_INSTRUMENT_EVENT_FLAG_TIMEOUT 5 +#define CYG_INSTRUMENT_EVENT_FLAG_WAKE 6 +#define CYG_INSTRUMENT_EVENT_FLAG_POLL 7 + +// Bitmap scheduler events + +#define CYG_INSTRUMENT_EVENT_BITMAP_SCHEDULE 1 +#define CYG_INSTRUMENT_EVENT_BITMAP_ADD 2 +#define CYG_INSTRUMENT_EVENT_BITMAP_REM 3 +#define CYG_INSTRUMENT_EVENT_BITMAP_ENQUEUE 4 +#define CYG_INSTRUMENT_EVENT_BITMAP_DEQUEUE 5 +#define CYG_INSTRUMENT_EVENT_BITMAP_REMOVE 6 // User events @@ -445,6 +465,34 @@ externC char * cyg_instrument_msg(CYG_WO #endif // ------------------------------------------------------------------------- +// Flag instrumentation + +#ifdef CYGDBG_KERNEL_INSTRUMENT_FLAG + +#define CYG_INSTRUMENT_FLAG(_event_,_arg1_,_arg2_) \ + CYG_INSTRUMENT(CYGINST_EVENT(FLAG,_event_),_arg1_,_arg2_) + +#else + +#define CYG_INSTRUMENT_FLAG(_event_,_arg1_,_arg2_) + +#endif + +// ------------------------------------------------------------------------- +// Bitmap instrumentation + +#ifdef CYGDBG_KERNEL_INSTRUMENT_BITMAP + +#define CYG_INSTRUMENT_BITMAP(_event_,_arg1_,_arg2_) \ + CYG_INSTRUMENT(CYGINST_EVENT(BITMAP,_event_),_arg1_,_arg2_) + +#else + +#define CYG_INSTRUMENT_BITMAP(_event_,_arg1_,_arg2_) + +#endif + +// ------------------------------------------------------------------------- // User instrumentation #ifdef CYGDBG_KERNEL_INSTRUMENT_USER
--- a/packages/kernel/current/include/instrument_desc.h +++ b/packages/kernel/current/include/instrument_desc.h @@ -19,10 +19,18 @@ struct instrument_desc_s instrument_desc {"BINSEM", 0x0600}, {"BINSEM_CLAIM", 1}, {"BINSEM_POST", 5}, +{"BINSEM_TIMEOUT", 7}, {"BINSEM_TRY", 4}, {"BINSEM_WAIT", 2}, {"BINSEM_WAKE", 6}, {"BINSEM_WOKE", 3}, +{"BITMAP", 0x0e00}, +{"BITMAP_ADD", 2}, +{"BITMAP_DEQUEUE", 5}, +{"BITMAP_ENQUEUE", 4}, +{"BITMAP_REM", 3}, +{"BITMAP_REMOVE", 6}, +{"BITMAP_SCHEDULE", 1}, {"CLOCK", 0x0800}, {"CLOCK_ISR", 3}, {"CLOCK_TICK_END", 2}, @@ -42,6 +50,14 @@ struct instrument_desc_s instrument_desc {"CONDVAR_WAIT", 1}, {"CONDVAR_WAKE", 4}, {"CONDVAR_WOKE", 2}, +{"FLAG", 0x0d00}, +{"FLAG_MASKBITS", 4}, +{"FLAG_POLL", 7}, +{"FLAG_SETBITS", 3}, +{"FLAG_TIMEOUT", 5}, +{"FLAG_WAIT", 1}, +{"FLAG_WAKE", 6}, +{"FLAG_WOKE", 2}, {"INTR", 0x0300}, {"INTR_ACK", 14}, {"INTR_ATTACH", 6},
--- a/packages/kernel/current/src/sched/bitmap.cxx +++ b/packages/kernel/current/src/sched/bitmap.cxx @@ -8,7 +8,7 @@ // ####ECOSGPLCOPYRIGHTBEGIN#### // ------------------------------------------- // This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2010 Free Software Foundation, Inc. // // eCos is free software; you can redistribute it and/or modify it under // the terms of the GNU General Public License as published by the Free @@ -99,6 +99,8 @@ Cyg_Thread *Cyg_Scheduler_Implementation cyg_uint32 index; HAL_LSBIT_INDEX(index, run_queue); + + CYG_INSTRUMENT_BITMAP(SCHEDULE, thread_table[index], index); return thread_table[index]; } @@ -108,6 +110,8 @@ Cyg_Thread *Cyg_Scheduler_Implementation void Cyg_Scheduler_Implementation::add_thread(Cyg_Thread *thread) { CYG_REPORT_FUNCTION(); + + CYG_INSTRUMENT_BITMAP(ADD, thread, thread->priority); CYG_ASSERT((CYG_THREAD_MIN_PRIORITY >= thread->priority) && (CYG_THREAD_MAX_PRIORITY <= thread->priority), @@ -142,6 +146,8 @@ void Cyg_Scheduler_Implementation::add_t void Cyg_Scheduler_Implementation::rem_thread(Cyg_Thread *thread) { CYG_REPORT_FUNCTION(); + + CYG_INSTRUMENT_BITMAP(REM, thread, thread->priority); CYG_ASSERT( thread_table[thread->priority] == thread, "Invalid thread priority" ); @@ -257,6 +263,8 @@ Cyg_ThreadQueue_Implementation::Cyg_Thre void Cyg_ThreadQueue_Implementation::enqueue(Cyg_Thread *thread) { CYG_REPORT_FUNCTION(); + + CYG_INSTRUMENT_BITMAP(ENQUEUE, this, thread); wait_queue |= 1<<thread->priority; thread->queue = CYG_CLASSFROMBASE(Cyg_ThreadQueue, @@ -273,7 +281,11 @@ Cyg_Thread *Cyg_ThreadQueue_Implementati // Isolate ls bit in run_queue. cyg_sched_bitmap next_thread = wait_queue & -wait_queue; - if( next_thread == 0 ) return NULL; + if( next_thread == 0 ) + { + CYG_INSTRUMENT_BITMAP(DEQUEUE, this, NULL); + return NULL; + } wait_queue &= ~next_thread; @@ -283,6 +295,8 @@ Cyg_Thread *Cyg_ThreadQueue_Implementati Cyg_Thread *thread = Cyg_Scheduler::scheduler.thread_table[index]; + CYG_INSTRUMENT_BITMAP(DEQUEUE, this, thread); + thread->queue = NULL; return thread; @@ -311,6 +325,8 @@ Cyg_Thread *Cyg_ThreadQueue_Implementati void Cyg_ThreadQueue_Implementation::remove(Cyg_Thread *thread) { CYG_REPORT_FUNCTION(); + + CYG_INSTRUMENT_BITMAP(REMOVE, this, thread); wait_queue &= ~(1<<thread->priority); thread->queue = NULL;
--- a/packages/kernel/current/src/sync/flag.cxx +++ b/packages/kernel/current/src/sync/flag.cxx @@ -8,7 +8,7 @@ // ####ECOSGPLCOPYRIGHTBEGIN#### // ------------------------------------------- // This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2010 Free Software Foundation, Inc. // // eCos is free software; you can redistribute it and/or modify it under // the terms of the GNU General Public License as published by the Free @@ -137,6 +137,9 @@ Cyg_Flag::maskbits( Cyg_FlagValue arg ) Cyg_Scheduler::lock(); value &= arg; + + CYG_INSTRUMENT_FLAG(MASKBITS, this, value); + // no need to wake anyone up; no waiter can become valid in // consequence of this operation. @@ -164,6 +167,8 @@ Cyg_Flag::setbits( Cyg_FlagValue arg ) // OR in the argument to get a new flag value. value |= arg; + CYG_INSTRUMENT_FLAG(SETBITS, this, value); + // anyone waiting? if ( !(queue.empty()) ) { FlagWaitInfo *p; @@ -183,6 +188,9 @@ Cyg_Flag::setbits( Cyg_FlagValue arg ) // success! awaken the thread thread->set_wake_reason( Cyg_Thread::DONE ); thread->wake(); + + CYG_INSTRUMENT_FLAG(WAKE, this, thread); + // return the successful value to it p->value_out = value; // do we clear the value; is this the end? @@ -250,9 +258,13 @@ Cyg_Flag::wait( Cyg_FlagValue pattern, W // keep track of myself on the queue of waiting threads queue.enqueue( self ); + CYG_INSTRUMENT_FLAG(WAIT, this, value); + // Allow other threads to run Cyg_Scheduler::reschedule(); + CYG_INSTRUMENT_FLAG(WOKE, this, value); + CYG_ASSERT( ((CYG_ADDRWORD)&saveme) == Cyg_Thread::self()->get_wait_info(), "Wait info lost" ); @@ -337,9 +349,13 @@ Cyg_Flag::wait( Cyg_FlagValue pattern, W // keep track of myself on the queue of waiting threads queue.enqueue( self ); + CYG_INSTRUMENT_FLAG(WAIT, this, value); + // Allow other threads to run Cyg_Scheduler::reschedule(); + CYG_INSTRUMENT_FLAG(WOKE, this, value); + CYG_ASSERT( ((CYG_ADDRWORD)&saveme) == Cyg_Thread::self()->get_wait_info(), "Wait info lost" ); @@ -347,6 +363,7 @@ Cyg_Flag::wait( Cyg_FlagValue pattern, W switch( self->get_wake_reason() ) { case Cyg_Thread::TIMEOUT: + CYG_INSTRUMENT_FLAG(TIMEOUT, this, value); result = false; break; @@ -406,6 +423,8 @@ Cyg_Flag::poll( Cyg_FlagValue pattern, W if ( result && (Cyg_Flag::CLR & mode) ) value = 0; + CYG_INSTRUMENT_FLAG(POLL, this, result); + Cyg_Scheduler::unlock(); CYG_REPORT_RETVAL( result );
