Hello World


Included with collectl is the example file hello.ph which is a collectlized version of hello world. It simulates a hw subsystem consisting of 3 hw instances, which in turn report a single counter. Here is an example of its simulated /proc data, which is shown by using -d4. Also notice in this case the discriminator is hw but -n is also included in the calls to record() to further identify individual devices:

collectl --imp hello -d4
>>> 1238167880.003 <<<
hw-0 HelloWorld 0
hw-1 HelloWorld 10
hw-2 HelloWorld 40
You can use this example module with virtually any combinations of switches and any other collectl subsystems as well as exporting the output over a socket, writing to a raw file or playing it back. As you should realize by now the combinations are far too extensive to list so below is only the simplest one, showing this data combined with cpu stats in brief format with timestamps in msecs.
collectl --imp hello -sc -oTm
#             <--------CPU--------><-Hello->
#Time         cpu sys inter  ctxsw   Total
11:40:29.002    0   0  1027    126     140
11:40:30.002    0   0  1012    138     230
For further information on using this capability see hello.ph which has been heavily annotated and should make a good staring template for developing your own custom modules.
updated Feb 21, 2011