I would probably guess that you'd just copy the behavior of iostat and vmstat so that it's a familiar behavior for people.I mainly mean the text file behavior:
- output one line once, containing the percentages about the last second (= one sec delay as data is gathered)
- output one line once, containing a 1 for each unit that is busy at that moment
So you would just output a line of data after the prescribed time period and have the position of the data be significant. Effectively a space deliminated output.
Just have the default something that makes sense and let users optionally specify time periods. Limitations on time periods required to get meaningful results should be specified in documentation. See the man files for those above mentioned programs and see if that could be meaningfully applied to what you are doing.If you want the second, the execution overhead becomes big (~17ms), so you can't have really accurate results - getting say 1000 ticks per sec becomes impossible.
For example; if I am running a series of compute nodes in a cluster I probably am not going to want to have per-second resolution. More then likely I would like a report every five minutes or so. Anything shorter of that you start running into issues with network overhead and nagios overhead and whatnot when dealing with dozens or hundreds of systems. So it would run once every 5 minutes and gather statistics for 20 seconds. Typically 30 seconds is the time out for programs like Nagios so I wouldn't want to gather stats for longer then that. Or possibly have a running program that monitors constantly and then queries that daemon for reports every five minutes. Something like that if you can imagine it.
You could also throw load averages into the mix. 1 minute, 5 minutes, 15 minute averages similar to how 'uptime' load works.Alternatively, it could output either of those until terminated. Percentages once per second, or direct values once per tick. Optionally with a timeout or a max number of lines.
I don't know the nature of the registers to give more specific information then that, unfortunately.