1 /* this is a program which uses eCos instrumentation buffers; it needs
2 to be linked with a kernel which was compiled with support for
6 #include <pkgconf/kernel.h>
7 #include <cyg/kernel/instrmnt.h>
8 #include <cyg/kernel/kapi.h>
10 #ifndef CYGVAR_KERNEL_INSTRUMENT_EXTERNAL_BUFFER
11 # error You must configure eCos with CYGVAR_KERNEL_INSTRUMENT_EXTERNAL_BUFFER
14 struct Instrument_Record
16 CYG_WORD16 type; // record type
17 CYG_WORD16 thread; // current thread id
18 CYG_WORD timestamp; // 32 bit timestamp
19 CYG_WORD arg1; // first arg
20 CYG_WORD arg2; // second arg
23 struct Instrument_Record instrument_buffer[20];
24 cyg_uint32 instrument_buffer_size = 20;
30 cyg_instrument_enable(CYG_INSTRUMENT_CLASS_CLOCK, 0);
31 cyg_instrument_enable(CYG_INSTRUMENT_CLASS_THREAD, 0);
32 cyg_instrument_enable(CYG_INSTRUMENT_CLASS_ALARM, 0);
34 printf("Program to play with instrumentation buffer\n");
38 cyg_instrument_disable(CYG_INSTRUMENT_CLASS_CLOCK, 0);
39 cyg_instrument_disable(CYG_INSTRUMENT_CLASS_THREAD, 0);
40 cyg_instrument_disable(CYG_INSTRUMENT_CLASS_ALARM, 0);
42 for (i = 0; i < instrument_buffer_size; ++i) {
43 printf("Record %02d: type 0x%04x, thread %d, ",
44 i, instrument_buffer[i].type, instrument_buffer[i].thread);
45 printf("time %5d, arg1 0x%08x, arg2 0x%08x\n",
46 instrument_buffer[i].timestamp, instrument_buffer[i].arg1,
47 instrument_buffer[i].arg2);