diff options
author | fche <fche> | 2006-08-12 05:13:09 +0000 |
---|---|---|
committer | fche <fche> | 2006-08-12 05:13:09 +0000 |
commit | 814bc89d4635f101b2c0077598f31aad95ed15b7 (patch) | |
tree | 407a49dbaf446af4751f5068607a7fb8dad0611d /testsuite/systemtap.samples/tcptest.stp | |
parent | 6b6d04673a1ef175821afc7d4fabdb496698e8e3 (diff) | |
download | systemtap-steved-814bc89d4635f101b2c0077598f31aad95ed15b7.tar.gz systemtap-steved-814bc89d4635f101b2c0077598f31aad95ed15b7.tar.xz systemtap-steved-814bc89d4635f101b2c0077598f31aad95ed15b7.zip |
2006-08-12 Frank Ch. Eigler <fche@elastic.org>
* configure.ac, Makefile.am: Descend into testsuite/
directory. Remove local test logic.
* configure, Makefile.in: Regenerated.
* runtest.sh: Not yet removed.
* HACKING: Update for new testsuite layout.
2006-08-12 Frank Ch. Eigler <fche@elastic.org>
* all: Reorganized old pass-1..4 tests one dejagnu bucket.
Moved over old pass-5 tests, except for disabled syscalls tests.
* Makefile (installcheck): New target for running pass-1..5
tests against installed systemtap.
Diffstat (limited to 'testsuite/systemtap.samples/tcptest.stp')
-rw-r--r-- | testsuite/systemtap.samples/tcptest.stp | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/testsuite/systemtap.samples/tcptest.stp b/testsuite/systemtap.samples/tcptest.stp new file mode 100644 index 00000000..2c88e2c7 --- /dev/null +++ b/testsuite/systemtap.samples/tcptest.stp @@ -0,0 +1,73 @@ +#! stap +global uids, pidnames, send_bytes, recv_bytes, pid_ports, pid_src_ips, pid_rtos +global pid_state, pid_mss, pid_ssthresh, pid_cwnd, totalbytes + +probe begin { log("systemtap starting probe") } + +probe end { + log("systemtap ending probe") + printf("TCP totalbytes: %d\n", totalbytes) +} + +function print_report() +{ + lines = 0; + log ("UID\tPID\tSIZE\tNAME\t\t\tPORT\tSOURCE\t\tRTO\tRCVMSS\tSSTHRES\tCWND\tSTATE") + for (lines = 0; lines <= 21; lines ++) { + if (!lines) { + foreach (_pid_ in pidnames) { + printf("%d\t%d\t%d\t%s\t\t\t%d\t%s\t%d\t%d\t%d\t%d\t%d\n", + uids[_pid_],_pid_,send_bytes[_pid_] + recv_bytes[_pid_], + pidnames[_pid_],pid_ports[_pid_], + pid_src_ips[_pid_],pid_rtos[_pid_], pid_mss[_pid_], + pid_ssthresh[_pid_],pid_cwnd[_pid_],pid_state[_pid_]); + lines++ + } + } else { + print("\n") + } + } +} + +probe tcp.sendmsg { + pid_ports[pid()] = inet_get_local_port(sock) + pid_src_ips[pid()] = inet_get_ip_source(sock) + pid_rtos[pid()] = tcp_get_info_rto(sock) +} + +probe tcp.recvmsg { + pid_cwnd[pid()] = tcp_get_info_snd_cwnd(sock) + pid_mss[pid()] = tcp_ts_get_info_rcv_mss(sock) + pid_ssthresh[pid()] = tcp_ts_get_info_snd_ssthresh(sock) + pid_state[pid()] = tcp_ts_get_info_state(sock) +} + +probe tcp.sendmsg.return { + if (size > 0) { + send_bytes[pid()] += size + totalbytes += size + pidnames[pid()] = execname() + uids[pid()] = uid() + } +} + +probe tcp.recvmsg.return { + if (size > 0) { + recv_bytes[pid()] += size + totalbytes += size + pidnames[pid()] = execname() + uids[pid()] = uid() + } +} + +probe tcp.disconnect { + delete pidnames[pid()] +} + +probe timer.ms(2000) { + print_report() + foreach (_pid_ in pidnames) { + send_bytes[_pid_] = 0 + recv_bytes[_pid_] = 0 + } +} |