Mercurial > ecos
diff packages/kernel/current/src/instrmnt/meminst.cxx @ 177:4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
| author | jlarmour |
|---|---|
| date | Fri, 10 Aug 2001 19:27:55 +0000 |
| parents | bf00f99aec69 |
| children | f62680ef1804 |
line wrap: on
line diff
--- a/packages/kernel/current/src/instrmnt/meminst.cxx +++ b/packages/kernel/current/src/instrmnt/meminst.cxx @@ -117,6 +117,20 @@ cyg_uint32 instrument_flags[(CYG_INSTRUM // ------------------------------------------------------------------------- +#ifdef CYGPKG_KERNEL_SMP_SUPPORT + +HAL_SPINLOCK_TYPE instrument_lock = HAL_SPINLOCK_INIT_CLEAR; + +#else + +#define HAL_SPINLOCK_SPIN( __lock ) + +#define HAL_SPINLOCK_CLEAR( __lock ) + +#endif + +// ------------------------------------------------------------------------- + void cyg_instrument( cyg_uint32 type, CYG_ADDRWORD arg1, CYG_ADDRWORD arg2 ) { @@ -131,11 +145,16 @@ void cyg_instrument( cyg_uint32 type, CY #endif { HAL_DISABLE_INTERRUPTS(old_ints); - + HAL_SPINLOCK_SPIN( instrument_lock ); + Instrument_Record *p = instrument_buffer_pointer; Cyg_Thread *t = Cyg_Scheduler::get_current_thread(); p->type = type; - p->thread = (t==0)?0xFFFF:t->get_unique_id(); + p->thread = (t==0)?0x0FFF:t->get_unique_id(); +#ifdef CYGPKG_KERNEL_SMP_SUPPORT + // Add CPU id to in top 4 bytes of thread id + p->thread = (p->thread&0x0FFF)|(CYG_KERNEL_CPU_THIS()<<12); +#endif #ifdef CYGVAR_KERNEL_COUNTERS_CLOCK // p->timestamp = Cyg_Clock::real_time_clock->current_value_lo(); HAL_CLOCK_READ( &p->timestamp ); @@ -156,6 +175,7 @@ void cyg_instrument( cyg_uint32 type, CY if( p != &instrument_buffer_end ) instrument_buffer_pointer = p; #endif + HAL_SPINLOCK_CLEAR( instrument_lock ); HAL_RESTORE_INTERRUPTS(old_ints); }
