-
Notifications
You must be signed in to change notification settings - Fork 3
/
aio_read.stp
56 lines (42 loc) · 1.48 KB
/
aio_read.stp
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
sudo stap -v aio_read.stp
This script is used to retrieve all the read request to the disk with related url and disk path.
code:
2526 int CacheVC::handleRead(...)
2603 io.action = this;
2604 io.thread = mutex->thread_holding->tt == DEDICATED ? AIO_CALLBACK_THREAD_ANY : mutex->thread_holding;
2605 SET_HANDLER(&CacheVC::handleReadDone);
2606 ink_assert(ink_aio_read(&io) >= 0);
2607 CACHE_DEBUG_INCREMENT_DYN_STAT(cache_pread_count_stat);
2608 return EVENT_CONT;
output:
http://192.168.131.128/am.txt, /dev/sdb: 3072
http://192.168.131.128/slayer.txt, /dev/sdb: 3072
http://192.168.131.128/sm.pdf, /dev/sdc: 42535936
*/
global dct;
probe process("/usr/bin/traffic_server").statement("*@Cache.cc:2606") {
if ($this->request->m_http != NULL) {
ui = $this->request->m_http->u->req->m_url_impl;
pth = $this->vol->path;
n = $this->io->aiocb->aio_nbytes;
ph = @cast(ui, "URLImpl")->m_ptr_host;
lh = @cast(ui, "URLImpl")->m_len_host;
sh = user_string_n(ph ,lh);
pp = @cast(ui, "URLImpl")->m_ptr_path;
lp = @cast(ui, "URLImpl")->m_len_path;
sp = user_string_n(pp ,lp);
url = "http://" . sh . "/" . sp;
dct[url, user_string(pth)] += n;
}
}
probe timer.s(3)
{
foreach ([u, p] in dct)
printf("%s, %s: %d\n", u, p, dct[u, p]);
delete dct
}
probe end {
foreach ([u, p] in dct)
printf("%s, %s: %d\n", u, p, dct[u, p]);
}