1 #include <pkgconf/kernel.h>
2 #include <cyg/kernel/ktypes.h> // base kernel types
3 #include <cyg/kernel/instrmnt.h>
8 // -------------------------------------------------------------------------
9 // Instrumentation record.
11 struct Instrument_Record
13 CYG_WORD16 type; // record type
14 CYG_WORD16 thread; // current thread id
15 CYG_WORD timestamp; // 32 bit timestamp
16 CYG_WORD arg1; // first arg
17 CYG_WORD arg2; // second arg
20 // -------------------------------------------------------------------------
22 #ifdef CYGDBG_KERNEL_INSTRUMENT_MSGS
23 #define CYGDBG_KERNEL_INSTRUMENT_MSGS_DEFINE_TABLE
24 #include <cyg/kernel/instrument_desc.h>
26 externC char * cyg_instrument_msg(CYG_WORD16 type) {
28 struct instrument_desc_s *record;
29 struct instrument_desc_s *end_record;
32 record = instrument_desc;
33 end_record = &instrument_desc[CYG_NELEM(instrument_desc)-1];
35 event = type & 0x00ff;
37 while ((record != end_record) && (record->num != cl)) {
41 if (record->num == cl) {
43 while ((record != end_record) && (record->num != event) &&
44 (record->num < 0xff)) {
48 if (record->num == event) {
52 return("Unknown event");
54 #endif // CYGDBG_KERNEL_INSTRUMENT_MSGS
56 void usage(char *myname)
58 fprintf(stderr,"Usage: %s <filename>\n",myname);
59 fprintf(stderr,"where filename is that of the instrumentation data");
62 int main(int argc, char * argv[])
67 struct Instrument_Record record;
77 file = fopen(filename, "r");
79 fprintf(stderr,"Error opening file %s: ",filename);
85 fread(&record,sizeof(record),1,file);
86 if (record.type == 0) {
90 #ifdef CYGDBG_KERNEL_INSTRUMENT_MSGS
91 printf("%4d Record type (0x%04x): %-20s thread %2d, ",
92 cnt++,record.type,cyg_instrument_msg(record.type),
95 printf("%4d Record type 0x%04x, thread %2d, ",
96 cnt++,record.type, record.thread);
98 printf("time %5d, arg1 0x%08x, arg2 0x%08x\n",
99 record.timestamp, record.arg1,