per-entity statistics

Jose R. Santos jrs@us.ibm.com
Thu Jan 12 16:17:00 GMT 2006


Frank Ch. Eigler wrote:

>Martin Peschke <mp3@de.ibm.com> writes:
>
>
>That's not how I'd do it.  Instead, something like:
>
>##### scsi-latencies.stp
>
>global lun_latencies # [lun:number]
>global devlun_latencies # [dev:number, lun:number]
>
>probe scsi.latencies = kernel.function("....") {
>  if (! scsi_lun_selected ($lun)) next
>  lat = EXPR
>  lun_latencies[$lun] <<< lat
>  devlun_latencies[$dev,$lun] <<< lat
>}
>
>probe end {
>  # report?
>}
>
>##### scsi-latencies-selected.stp
>
>function scsi_lun_selected(id) { return 1 }
>  
>
FYI

Unless you only have a single SCSI card with just one channel, just 
getting the LUN is not enough. You need the SCSI host number, channel, 
lun, and ID. Here is a bit of code from the trace tool that shows how to 
get that information using SystemTap.

function log_scsi_iodone_extra(var:long)
%{
struct scsi_cmnd *cmd = (struct scsi_cmnd *)((long)THIS->var);
long long scsi_info;

scsi_info = ((cmd->device->host->host_no & 0xFF) << 24) |
((cmd->device->channel & 0xFF) << 16) |
((cmd->device->lun & 0xFF) << 8) |
(cmd->device->id & 0xFF);

/* scsi_info|data_direction|cmd_identifier| */
_stp_printf("%lld|%d|%d", scsi_info, cmd->sc_data_direction, cmd->pid);
%}


Hope it helps

-JRS



More information about the Systemtap mailing list