-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdeviceseeks.stp
More file actions
36 lines (32 loc) · 889 Bytes
/
deviceseeks.stp
File metadata and controls
36 lines (32 loc) · 889 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#! /usr/bin/env stap
#
# Copyright (C) 2010 Red Hat, Inc.
# By Dominic Duval, Red Hat Inc.
# dduval@redhat.com
#
# Keeps track of seeks on devices.
# Shows how to use hist_log.
#
# USAGE: stap deviceseeks.stp
#
global seeks, oldsec
probe ioblock_trace.request {
if (size == 0) next
%( $# == 1 %? if (devname !~ @1) next %) // reject mismatching device names
sectorsize = (@defined($q->limits->logical_block_size)
? $q->limits->logical_block_size
: (@defined($q->logical_block_size) ? $q->logical_block_size
: $q->hardsect_size))
# printf("%s %s\n", devname, rw ? "w" : "r")
sec = sector
seeks[devname] <<< sec - oldsec[devname]
oldsec[devname] = sector + (size/sectorsize)
}
probe timer.s(10), end, error {
printf("\n")
foreach ([devname] in seeks- limit 5) {
printf("Device: %s\n", devname)
println(@hist_log(seeks[devname]))
}
delete seeks
}