Created a simple monitoring tool named wspy for workload spy. Source is hosted at http://www.github.com/mvermeulen/wspy
This is a wrapper program that collects data as the program runs. The initial program has two data collectors:
- trace – which uses the ftrace linux kernel tracer to turn on tracing for scheduler events for fork/exec/exit. It parses these to create and display a process tree.
- timer – which fires off a timer once per second to run a collector for /proc/stat contents
This program is somewhat different from the “trup” utility I created while at AMD. That program instrumentation used the “ptrace” capability to trace all processes in a tree and then instrument them. This approach might have the following advantages and disadvantages:
- Using capabilities like ftrace is hopefully less intrusive and hence less performance overhead than ptracing every process.
- ftrace seems to require a root setup; so the program runs as root, though I’ve added a “-u” option to set the user for the child.
- Instrumentation is based on the entire system; rather than individual processes. The pro/con of this is less precision for an individual application (particularly a single process) but a bigger picture of the overall system state.
wspy code is an initial code base that I can mutate and change for other tracing.
Following is an example of initial usage:
mev@popayan:~/wspy$ ./wspy -? ./wspy: fatal error: usage: ./wspy [CcFf][-r name][-u uid]
... -C turn on CPU usage tracing (default = on) -c turn off CPU usage tracing (default = on) -F turn on kernel scheduler tracing (default = on) -f turn off kernel scheduler tracing (default = on) -r filter for name of process tree root -u run as user mev@popayan:~/wspy$
The following command line was run on the Phoronix Test Suite to run the c-ray application:
mev@popayan:~/wspy$ sudo ./wspy -o wspy.output.txt -r ./c-ray -u mev phoronix-test-suite batch-run c-ray
Following is a link to the output file created. The “-r” helps trim auxiliary process tree information.
Clearly more to do both in data output/presentation and maturity of this program. However, also useful to have a code base that runs on x86/ARM to now tweak for other instrumentation.