SVG: Fix how min and max values are calculated for some memory metrics
Be more accurate when calculating the min and max values for memused,
swpused, %memused, %commit, %swpused and %swpcad.
Previously these values could have been wrong if the total amount of
memory or swap had changed.
Using values expressed in kB to draw graphs for memory metrics made sadf
reach some (Firefox?) limits: Values bigger than 10,000,000 made the
graph to disappear on screen unless we clicked on the view.
Using smaller values (ie. values expressed in MB) fixes the problem. And
they are easier to read for a human BTW :-)
SVG: Update core functions to handle integer metrics
Update save_extrema() functions for metrics which are not calculated
over a time interval.
Add lniappend() function to create graphs for metrics with integer
values.
Some metrics are integer values: Their min/max values should then be
displayed as integer values (xxxx and not xxxx.00).
Such a metric will be identified by a leading ~ character in its name.
Sebastien GODARD [Fri, 25 Mar 2016 12:05:47 +0000 (13:05 +0100)]
SVG: Set a min value on Y axis
Set a min value on Y axis so that graduations remain meaningful.
For instance, if the max value for a graph was 0.01 then the graduations
on the Y axis were 0.01, 0.01 and 0.01 (for 3 horizontal lines). In this
case, this patch will set the max value to 0.03 to get some meaningful
graduations values: 0.01, 0.02 and 0.03.
Sebastien GODARD [Fri, 25 Mar 2016 09:39:02 +0000 (10:39 +0100)]
Merge branch 'portante-master'
The cprintf_u64() function always reads passed parameters as unsigned
long long, even if the actual parameter is unsigned long or unsigned
int.
This does not work correctly on 32-bit systems, where sizeof(unsigned
long long) != sizeof(unsigned int). For example sar -q displays:
/tmp> sar -q 1 4
Linux 4.4.0-1-686-pae (vox) 22.03.2016 _i686_ (1 CPU)
Fix #107.
Offline CPU were not properly taken into account when creating SVG
graphs for CPU statistics.
This was because min and max values were not updated for the metrics
(%user, %nice, etc.) This should be done even for offline (and also
tickless) CPUs.
Sebastien GODARD [Fri, 18 Mar 2016 13:41:07 +0000 (14:41 +0100)]
SVG: Add SVG output for CPU statistics
Each CPU (including CPU "all") has a bar graph, with each metric being
cumulative.
At the present time, %idle is not displayed because I think the graph is
much more readable without it. But an SVG option to display it will
possibly be added in the future.
Sebastien GODARD [Sat, 12 Mar 2016 10:27:30 +0000 (11:27 +0100)]
sar: Fix possible compatibility issues between sysstat versions
Fix an issue that made sar unable to read statistics for network
and disk devices from a datafile created by a more recent version of
sysstat when the size of the structures used to save those statistics
was greater than that of the current version.
This may be the case when eg. new fields are appended to network or disk
structures.
Sebastien GODARD [Sat, 12 Mar 2016 09:54:22 +0000 (10:54 +0100)]
SVG: Remove decimals in Y graduations for bar graphs
Bar graphs are used to display metrics expressed as percentage values.
Graduations on the Y axis are fixed values (0, 25, 50, 75 and 100) that
don't need to be decimal numbers (0.00, 25.00, ...)
Commit f5d9bce dealt with network interfaces that can be dynamically
registered or unregistered in /proc/net/dev. But it assumed that network
interfaces appear always at the same position in the /proc/net/dev file.
As this is not necessarily the case, this patch makes sure that we
update the right graph corresponding to the same network interface.
Sebastien GODARD [Fri, 11 Mar 2016 16:54:57 +0000 (17:54 +0100)]
Fix possible confusion among network interfaces
Some wrong statistics could have been displayed when a new network
interface was dynamically registered and appeared in the middle of
the list of existing interfaces in /proc/net/dev.
This patch fixes this problem (that hardly ever happens), and
removes some redundant lines of code.
Sebastien GODARD [Fri, 11 Mar 2016 09:34:22 +0000 (10:34 +0100)]
SVG: Add graph for %ifutil metrics
Add a graph for the last metrics from network activity (%ifutil).
This a new type of graph (bar graph, whereas previous graphs were line
graphs) which will be used for all metrics expressed as percentage
values.
Network interfaces may be dynamically registered or unregistered.
That is to say they can appear in the /proc/net/dev file when
the corresponding device is connected, and also disappear when
the device is removed.
This patch tries to handle this so that graphs are drawn for
the interfaces which are connected on the fly. Graphs are drawn only
when the device is actually connected, which means that they may be
discontinuous if the device is connected, then disconnected, then
reconnected again, just like when a system restart occurrs.
At the present time, this patch assumes that the devices are always at
the same position in /proc/net/dev, which is not necessarily the case.
This will be fixed later.
SVG: Draw txkB/s and rxkB/s network metrics to scale
The metrics are expressed in kB/s whereas the corresponding counters are
saved in B/s. So recalculate min and max values in kB/s before drawing
graphs.
Sebastien GODARD [Wed, 24 Feb 2016 10:47:07 +0000 (11:47 +0100)]
SVG: Explicitly pass structures to be compared
The structures which will be scanned to check for min/max values need to
be explicitly passed to save_extrema() function. Indeed, for activities
with several items (eg. network statistics), we will need to scan each
item structure independently.
Sebastien GODARD [Mon, 22 Feb 2016 17:26:34 +0000 (18:26 +0100)]
SVG: Init newly allocated strings
Graph definition is made of successive SVG "path" commands concatenated
together. Make sure that the strings allocated to receive these definitions
are initialized before being used.
Sebastien GODARD [Fri, 19 Feb 2016 09:37:05 +0000 (10:37 +0100)]
SVG: Add SVG output for task creation and system switching activity.
Update sadf's SVG ouptput to create graphs for task creation and system
switching activity (this corresponds to the output of sar -w).
This is just a proof of concept.
Try it with "sadf -g /your/sa/datafile -- -w > out.html" and open
the resulting HTML file in your web browser.
Sebastien GODARD [Mon, 15 Feb 2016 16:36:48 +0000 (17:36 +0100)]
Add new FO_NO_TRUE_TIME flag
Define a new flag indicating that the timestamp cannot be displayed in
the original local time of the data file creator.
This flag will be used by the SVG output format, which also means that
the user won't be able to use sadf's option -t with this format.
read_next_sample() function didn't fill the timestamp for special
records (COMMENT or RESTART ones) that had to be ignored.
So add a new flag (SET_TIMESTAMPS) to tell read_next_sample() function
to set the timestamps for special records when this is needed.
Sebastien GODARD [Tue, 26 Jan 2016 21:43:23 +0000 (22:43 +0100)]
JSON: Don't display fchosts tag when no stats exist
The JSON print function can be called for A_NET_FC (Fibre Channel)
activity even if no statistics exist. This is because this activity has
the AO_CLOSE_MARKUP flag used to close the "network" section of the
output. Anyway, in this case (when no stats exist), it should only do
that (close the network section) et not display the "fchost" tag.
Sebastien GODARD [Mon, 25 Jan 2016 07:24:17 +0000 (08:24 +0100)]
Move JSON specific code to its corresponding function
A bit of code was specific to JSON output. So move this code to the
f_timestamp function used by JSON output format, so that the main code
remains generic.
Sebastien GODARD [Fri, 22 Jan 2016 12:57:42 +0000 (13:57 +0100)]
Move format specific code to its corresponding function
Incrementing tab variable was specific to XML output. So move this code
to the f_timestamp function used by XML output format, so that thee main
code remains generic.