RFE #140: mpstat: Provide CPU statistics based on NUMA node placement
This patch for mpstat provides CPU load statistics for NUMA nodes.
It uses CPU statistics read from /proc/stat file then split them among
all nodes based on node placement.
Node placement is determined using /sys/devices/system/cpu/cpu#/node#
file indicating which node the CPU is bound to. The node the CPU belongs
to is saved in an array of integers named cpu2node (e.g. cpu2node[3]
gives the node number for CPU#3).
The number of CPU per node is saved in another array of integers named
cpu_per_node (e.g. cpu_per_node[0] gives the number of CPU bound to
node#0).
The statistics for node N is calculated as the sum of statistics for
each CPU bound to node N divided by the number of CPU bound to that
node.
The patch assumes that statistics for node "all" are the same as
statistics for CPU "all".
Node statistics can be displayed using the new mpstat's option "-n"
(e.g. "mpstat -n 2 5"). Nodes to be displayed can be selected using
option "-N" the same way processors can be selected using option "-P"
(e.g. "mpstat -n -N 0,3 2 5").
PLEASE TEST THIS PATCH as my own machine offers limited possibilities.
Sebastien GODARD [Sat, 11 Feb 2017 16:56:01 +0000 (17:56 +0100)]
Make should immediately stop whenever a test failed
Make should stop and exit with a non zero status code whenever a test
(in the target "test") fails.
Without this patch, make executed all the tests (even when one of them
failed) and exited with a status code of 0, which is not what we want.
Sebastien GODARD [Fri, 10 Feb 2017 17:27:14 +0000 (18:27 +0100)]
SVG: Don't extend X axis beyond time end
When a time end has been entered (with option "-e hh:mm:ss"), don't
draw X axis beyond this limit even if some Linux Restart messages
exist after this time limit.
SVG: Properly terminate SVG file when no data have been found
When a data file contains only a Linux Restart message with no
statistics, trying to create SVG graphs with sadf -g resulted in an
error ("XML Parsing Error: no element found").
This patch fixes that and display "No data!" instead.
Add a new option ("packed") to tell sadf to put multiple charts on a row
when generating SVG graphs.
In fact, with this option, all charts from the same activity (and for
the same device) will appear on the same row.
Sebastien GODARD [Sat, 21 Jan 2017 08:30:37 +0000 (09:30 +0100)]
Add new regression tests
These tests make sure that sadf can convert a binary data file with an
old format to the up-to-date format, and also that sar can read old
datafiles (which may have been converted or not).
Sebastien GODARD [Sat, 21 Jan 2017 07:43:07 +0000 (08:43 +0100)]
Fix comment in /etc/sysconfig/sysstat file
When HISTORY is set to a value greater than 28, then logfiles are no
longer kept in multiple directories, but are named saYYYYMMDD providing
that sadc's option -D has been used.
Sebastien GODARD [Sun, 15 Jan 2017 13:24:47 +0000 (14:24 +0100)]
Remove isag support
isag (Interactive System Activity Grapher) is a script used to graph sar
data contributed by David Doubrava.
Though it is still included in sysstat package in the contrib directory,
it was no longer maintained and is now made deprecated by sadf and its
switch -g which can draw graphs in SVG format.
So remove all the options related to isag from Makefile and configure
scripts.
Sebastien GODARD [Sat, 14 Jan 2017 16:13:40 +0000 (17:13 +0100)]
Fix insecure data handling (Coverity CID#139643)
Quieten Coverity (CID#139643):
Copying hl without checking the length might overrun the 512-character
fixed-size string field. So use strncpy() function instead of strcpy().
Sebastien GODARD [Wed, 11 Jan 2017 12:23:12 +0000 (13:23 +0100)]
SVG: Give actual canvas height
Add a comment at the end of SVG output that indicates the actual canvas
height.
The actual height is frequently different (i.e. smaller) than that
indicated in the header of the SVG output. This is because some
activities have pre-allocated entries that don't result in graphs being
drawn, or because option 'skipempty' has been used.
Remove memory statistics from sar (those displayed by sar -R, not
sar -r!) I have always considered those data displayed by sar as a
"mistake from my youth". They are not related to the speed of any
specific device (except maybe CPU, but there are other means to
measure CPU speed...), so displaying data per second is just irrelevant.
Cast values to (unsigned long long) before calling pval()
pval() function, used by sadf for its raw output format, assumes values
type is unsigned long long. So cast the values to that type before
calling this function.
Sebastien GODARD [Sun, 18 Dec 2016 09:42:10 +0000 (10:42 +0100)]
sadf: Add new output format: raw (part 1)
Add a new output format to sadf to display statistics saved in a binary
data file in raw format. Counters values are displayed "as is", without
trying to calculate an average value over the elapsed time interval.
This is something I have selfishly wanted to have for a long time now,
mainly for debugging purpose.
This first patch adds all the necessary global functions, and implements
the raw format only for CPU and task creation/system switching
statistics.
When a newly registered device (network interface or disk) was
supernumerary (i.e. there was no slot left in the list to store it), it
would take the place of another device in the list. This other device
would also appear as new and its counters would jump as if starting from
zero. This patch fixes that.
Sebastien GODARD [Sun, 20 Nov 2016 18:06:54 +0000 (19:06 +0100)]
sar/mpstat: Allow selection of a range of IRQ/CPU
Update sar so that the user can now select a range of interrupts with
option -I (in addition to selecting individual interrupts).
E.g. "sar -I 2,5,10-16,400- (...)"
Keyword XALL is removed with option -I.
Keyword ALL selects all possible interrupts, including the sum of them.
Also update mpstat so that the user can select a range of processors
with option -P (in addition to selecting individual processors).
E.g. "mpstat -P all,0,5-7 (...)"
Sebastien GODARD [Sun, 20 Nov 2016 09:28:35 +0000 (10:28 +0100)]
mpstat: Rework option -P parsing
It is no longer possibe to specify individual CPUs and also to use
keyword ALL together (e.g. mpstat -P ALL,0,2) which is meaningless.
Also separate options "-P ALL" from "-P ON".
Sebastien GODARD [Sat, 19 Nov 2016 16:53:47 +0000 (17:53 +0100)]
sar: Allow selection of a range of CPU
Update sar so that the user can now select a range of CPUs with option -P
(in addition to selecting an individual CPU). It is also possible to
select CPU "all" which is the global average among all CPUs (not to be
confused with the "ALL" keyword which selects all the CPUs of the
machine).
E.g.:
sar -P 0,3-5,12- Selects CPUs #0, #3, #4, #5, and all the CPUs
from #12 and following.
sar -P all,1 Select CPU #1 and the global average CPU value
among all processors.
Sebastien GODARD [Thu, 17 Nov 2016 11:28:55 +0000 (12:28 +0100)]
iostat: Option -h also imply --human
Using option -h with iostat will also display sizes in human readable
format.
Option -h is already intended to make a report easier to read by a human
(especially when devices names are very long).
Sebastien GODARD [Thu, 17 Nov 2016 09:58:03 +0000 (10:58 +0100)]
sar: Display values in human readable format
Take into account new "--human" option to display values in human
readable format.
Functions cprintf_f() cprintf_u64() are modified to add the unit after
the value if requested.
Only a few options are concerned for sar.
Other commands are updated too, but the option will be activated in
separate patches.
Sebastien GODARD [Sat, 12 Nov 2016 17:21:33 +0000 (18:21 +0100)]
Move available free memory metric into default -r output
Move new "available free memory" metric into the default "sar -r"
output. (It was previously displayed with "sar -r ALL").
Update sar and sadf commands accordingly.
See comments in issue #133.