-
Notifications
You must be signed in to change notification settings - Fork 11
Description
I have a question regarding intended scope and extensibility of plot.
Rate of Change
the example script for plotting tx/rx counters is but one example of this
Plotting counters of various types is a common activity that I see myself using plot for. However, it currently doesn't provide the ability to handle rate of change - the burden of calculating rate of change presently depends on some external program that usually does something like the monitor() function in the example script.
Since this seems (at least to me) like a common use case, it would be nice to add an option such as:
-r plot rate of change
which maybe does something like:
(val - old_val) / sleep_time
to get a unit of "counters per second"
Generic Parsing
Presently plot expects the input value that it receives (stdout or file) to be a number represented as a string that can be converted to a double via strtod() (input.c:39).
Many counters exposed to userspace by the linux kernel are exported as a file that is not simply a file with a number in it, but has either 1. multiple counters or 2. surrounding text. Many files exposed via /proc/ are examples of this.
It would be really nice if plot supported a generic parsing functionality for extracting numbers from text. What I have in mind is:
-p regex:parse-string|<custom parser name>
where one could pass in PCRE regex to specify an extraction or optionally a name for a parser in C that they manually write