Chapter 4. Useful SystemTap Scripts
delete ifxmit
delete ifrecv
delete ifmerged
}
probe timer.ms(5000), end, error
{
print_activity()
}
Note that function print_activity() uses the following expressions:
n_xmit ? @sum(ifxmit[pid, dev, exec, uid])/1024 : 0
n_recv ? @sum(ifrecv[pid, dev, exec, uid])/1024 : 0
These expressions are if/else conditionals. The first statement is simply a more concise way of writing
the following psuedo code:
if n_recv != 0 then
@sum(ifrecv[pid, dev, exec, uid])/1024
else
0
nettop.stp
tracks which processes are generating network traffic on the system, and provides the
following information about each process:
• PID — the ID of the listed process.
• UID — user ID. A user ID of 0 refers to the root user.
• DEV — which ethernet device the process used to send / receive data (e.g. eth0, eth1)
• XMIT_PK — number of packets transmitted by the process
• RECV_PK — number of packets received by the process
• XMIT_KB — amount of data sent by the process, in kilobytes
• RECV_KB — amount of data received by the service, in kilobytes
nettop.stp
provides network profile sampling every 5 seconds. You can change this setting by editing
probe timer.ms(5000) accordingly.
nettop.stp
of the output from
[...]
PID
UID DEV
XMIT_PK RECV_PK XMIT_KB RECV_KB COMMAND
0
0 eth0
11178
0 eth0
PID
UID DEV
XMIT_PK RECV_PK XMIT_KB RECV_KB COMMAND
2886
4 eth0
11362
0 eth0
0
0 eth0
28
Example 4.1, "nettop.stp Sample Output"
over a 20-second period:
0
5
0
2
0
0
79
0
5
0
61
0
3
32
0
0 swapper
0 synergyc
0 cups-polld
5 firefox
3 swapper
contains an excerpt
Need help?
Do you have a question about the ENTERPRISE LINUX 5.4 - SYSTEMTAP BEGINNERS GUIDE and is the answer not in the manual?
Questions and answers