Home |
RTKernel-32 Programming Manual Function RTKSetTraceBufferSize Function RTKDumpTrace |
Function RTKDumpTraceRTKDumpTrace formats a trace entry as a text line and copies it to a string: char * RTKDumpTrace(char * Buffer, int Entry); ParametersBufferShould point to a string of at least 80 characters length. EntrySpecifies which entry to dump. "0" is the latest entry, "1" is the previous entry, etc. The Tracer should be disabled by a call to RTKStopTracing prior to dumping the buffer. return valuePoints behind the end of the string. Thus, it can be passed to RTKDumpTrace again to dump additional trace entries. RTKDumpTrace displays four columns next to the event index. The first column either contains a time stamp, the index of the CPU on which the event occurred, or nothing (see RTKConfig Flags RF_TRACE_TIME_US and RF_TRACE_TIME_NS). Subsequent column contain the name of the task or ISR which generated the event, the event name, and the name of an object associated with the event, if any. To dump the last 10 trace buffer entries, the following code can be used: char Buffer[2048]; char * B = Buffer; int i; B = RTKTraceHeader(B); for (i=9; i >=0; i--) B = RTKDumpTrace(B, i); printf(Buffer); Care must be taken to dimension the Buffer large enough to store the generated data. It should be at least 100 + N * 80 bytes in size, where N is the number of trace entries required. Alternatively, each text line generated can be written to a file to free the buffer. Please refer to demo program RTKDemo for examples of this technique (command 'TRACE'). The following output was generated by program RTKDemo while data was being received on COM2. It reflects the reception of two characters (with the second one still in the mailbox), a keypress, and a user event. Index CPU Time Current Task Event Object ------------------------------------------------------------ 184 0 - IRQ 3 Mailbox In Mailbox: Receive COM2 185 0 - IRQ 3 State: Ready Task: COM Receiver 186 0 - CPU Monitor State: Ready Task: CPU Monitor 187 0 - CPU Monitor State: Current Task: COM Receiver 188 0 - COM Receiver Mailbox Out Mailbox: Receive COM2 189 0 - COM Receiver State: TimedGet Mailbox: Receive COM2 190 0 - COM Receiver State: Current Task: CPU Monitor 191 0 - IRQ 1 Semaphore Inc Semaphore: Keyboard 192 0 - IRQ 1 State: Ready Task: Main Task 193 0 - CPU Monitor State: Ready Task: CPU Monitor 194 0 - CPU Monitor State: Current Task: Main Task 195 0 - Main Task Semaphore Dec Semaphore: Keyboard 196 0 - IRQ 3 Mailbox In Mailbox: Receive COM2 197 0 - IRQ 3 State: Ready Task: COM Receiver 198 0 - Main Task User Event 3 Number: 1234
|