This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Mike Mason <mmlnx@us.ibm.com> writes:
Here's a variation of Jose's script that uses the networking tapset and prints top-like output for transmits and receives. [...]
Thanks for posting it to the systemtap wiki.
Some minor style suggestions follow:
[...] ifxmit_p[pid(), dev_name] ++ ifxmit_b[pid(), dev_name] += length
These could be collapsed into a single statistics-aggregate array: # ifxmit[pid(), dev_name] <<< length
Then the printing routine would use @count(ifxmit[...]) and @sum(ifxmit[...])
to extract the two values. Same of course for ifrecv.
PID UID DEV XMIT_PK RECV_PK XMIT_KB RECV_KB COMMAND 0 0 eth0 9 10 486 672 swapper ERROR: empty aggregate near identifier 'execname' at nettop.stp:35:4 WARNING: Number of errors: 1, skipped probes: 0
execname[pid()] = execname() user[pid()] = uid() ifdevs[pid(), dev_name] = dev_name
Calling pid() so many times is worse than calling it once and caching
the result in a local variable ("p = pid()").
The way that the script tracks pid-to-uid and pid-to-execname mappings is not bad, though if that part were moved to new probes on fork or exec, it would allow the network-related probes to run concurrently on an SMP without fighting over locks.
- FChE
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |