This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

trace buffer tapset proposal


I have been looking over uses of systemtap. The flight recorder mode is useful for avoiding generating output. However, it may still generate a huge amount of output; basically output everything in the buffer. People might want want more focused output of data when a particular event occurs. Today I spent some time implementing a "trace buffer" tapset. Any comments about the implementation and use would be appreciated. The tapset has the following functions:

/**
 * sfunction trace_buffer_time - Default time of day for trace buffer
 */

/**
 * sfunction trace_buffer_create - Create a trace buffer
 * @name: Name of trace buffer
 * @size: Number of elements in trace buffer
 */

/**
 * sfunction trace_buffer_entry - Add an entry to a trace buffer
 * @name: Name of trace buffer
 * @line: Data to store in buffer
 */

/**
 * sfunction trace_buffer_print - Print out a trace buffer
 * @name: Name of trace buffer
 */

The tapset allows multiple trace_buffers to be used in the same script by giving each trace buffer a unique name.  The trace_buffer_time function is in a separate file, so the user can replace it is a different time base if desired.

Below is the sample set up to show output when a drive is unmounted.


 ../systemtap_write/install/bin/stap scsi_trace_buffer.stp 'kernel.function("deactivate_super")'
Back trace of events
[    27431318] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 28 00 00 00 2c 40 00 00 80 00 00
[    27434132] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 28 00 00 00 2c c0 00 00 80 00 00
[    27437933] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 28 00 00 00 2d 40 00 00 80 00 00
[    27440776] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 28 00 00 00 2d c0 00 00 80 00 00
[    27444553] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 28 00 00 00 2e 40 00 00 80 00 00
[    27447354] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 28 00 00 00 2e c0 00 00 80 00 00
[    27450406] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 28 00 00 00 2f 40 00 00 80 00 00
[    27453218] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 28 00 00 00 2f c0 00 00 80 00 00
[    27456482] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 28 00 00 00 30 40 00 00 80 00 00
[    27459370] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 28 00 00 00 30 c0 00 00 80 00 00
[    27462456] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 28 00 00 00 31 40 00 00 80 00 00
[    27465231] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 28 00 00 00 31 c0 00 00 80 00 00
[    27468569] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 28 00 00 00 32 40 00 00 80 00 00
[    27471363] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 28 00 00 00 32 c0 00 00 80 00 00
[    27474555] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 28 00 00 00 33 40 00 00 80 00 00
[    27477359] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 28 00 00 00 33 c0 00 00 80 00 00
[    27480429] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 28 00 00 00 34 40 00 00 80 00 00
[    27483264] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 28 00 00 00 34 c0 00 00 80 00 00
[    27486996] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 28 00 00 00 35 40 00 00 80 00 00
[    27489891] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 28 00 00 00 35 c0 00 00 80 00 00
[    27493048] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 28 00 00 00 36 40 00 00 80 00 00
[    27495851] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 28 00 00 00 36 c0 00 00 80 00 00
[    27498931] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 28 00 00 00 37 40 00 00 80 00 00
[    27501729] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 28 00 00 00 37 c0 00 00 80 00 00
[    27505418] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 28 00 00 00 38 40 00 00 80 00 00
[    27508265] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 28 00 00 00 38 c0 00 00 80 00 00
[    27512039] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 28 00 00 00 39 40 00 00 80 00 00
[    27515044] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 28 00 00 00 39 c0 00 00 80 00 00
[    27518154] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 28 00 00 00 3a 40 00 00 80 00 00
[    27521121] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 28 00 00 00 3a c0 00 00 80 00 00
[    27524300] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 28 00 00 00 3b 40 00 00 80 00 00
[    27527102] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 28 00 00 00 3b c0 00 00 80 00 00
[    27530236] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 28 00 00 00 3c 40 00 00 80 00 00
[    28611412] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 2a 00 06 55 31 d8 00 03 b0 00 00
[    28639875] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x06
 00 00 00 00 00 00 00
[    28640331] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x06
 00 00 00 00 00 00 00
[    30312985] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 2a 00 02 13 c6 60 00 00 08 00 00
[    30312922] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 2a 00 02 8b db 50 00 00 08 00 00
[    30314209] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 2a 00 03 16 f3 08 00 00 e8 00 00
[    30314840] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 35 00 00 00 00 00 00 00 00 00 00
[    30353826] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 2a 00 03 16 f3 f0 00 00 08 00 00
[    30353953] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 35 00 00 00 00 00 00 00 00 00 00
[    30639795] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x06
 00 00 00 00 00 00 00
[    30640372] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x06
 00 00 00 00 00 00 00
[    31133096] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 28 00 06 24 3d d8 00 00 88 00 00
[    31499572] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 2a 00 01 95 d2 c0 00 00 f0 00 00
[    31499617] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 2a 00 01 b7 1e 78 00 04 00 00 00
[    31499646] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x0a
 2a 00 01 b7 22 78 00 00 f0 00 00
[    32639934] SCSI  chan=0x00, target=0x00, lun=0x00, cmd_len=0x06
 00 00 00 00 00 00 00

Attachment: trace_buffer.stp
Description: Text document

Attachment: trace_buffer_time.stp
Description: Text document

Attachment: scsi_trace_buffer.stp
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]