iostat: Express requests average size in kB, not sectors
Since field "avgrq-sz" was renamed to "areq-sz", also change its unit:
This is now a number of kilobytes, and not sectors.
JSON output keeps both fields for backward compatibility: "avgrq-sz"
expressed in sectors, and "areq-sz" expressed in kilobytes.
iostat: Add new metrics in extended statistics output
Add the following metrics to iostat -x output:
%rrqm: percentage of read requests merged
%wrqm: percentage of write requests merged
rareq-sz: average size (in sectors) of the read requests
wareq-sz: average size (in sectors) of the write requests
The metric previously known as "avgqu-sz" has been renamed to "aqu-sz"
(except in the JSON output where the name remains unchanged).
The metric previously known as "avgrq-sz" has been renamed to "areq-sz"
(except in the JSON output where the name remains unchanged).
The "await" metric is no longer displayed in the default output (you
have separate values for reads and writes: "r_await", "w_await"),
except in the short output version where it replaces "r_await" and
"w_await".
This patch casts some variables to target type before they are used.
Without this patch, problems may happen (like issue #150) notably on 32
bit architectures where sizeof(long) is different from sizeof(long
long).
Sebastien GODARD [Sat, 27 May 2017 13:58:54 +0000 (15:58 +0200)]
SVG: Define a max number of horizontal lines for the background grid
When a graph for percentage values is displayed, a background grid with
horizontal lines for 25%, 50%, 75% and 100% is drawn.
This works well except when sadf gets a bogus value for the maximum
value reached by the metric. For example, if sadf thinks that the max
value is 123456789% then a high number of horizontal lines will be
drawn, resulting in a huge SVG file that can weigh hundreds of megabytes
or more (NB: There are metrics which are percentage values that can go
above 100%, e.g., %commit).
This patch fixes that by setting a limit for the number of horizontal
lines that can be drawn.
Sebastien GODARD [Wed, 24 May 2017 09:23:03 +0000 (11:23 +0200)]
Fix #153: sar program buffer overflow when options -s or -e specified
When a short time format is used with sar's options -s or -e (e.g.,
sar -s 04:00), 5 characters are copied by strncpy in parse_timestamp
to timestamp variable. Unfortunately these 5 characters do not contain
the termination, therefore the following strcat appends after the
next "random" null byte. Therefore writing beyond the end of timestamp.
This patch tries to prevent this by explicitly terminating.
Debian bug #863197.
Reported-by: Robert Luberda Signed-off-by: Bernhard Ubelacker <bernhardu@mailbox.org> Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
Fix #148: ARM: sadc crashes because of unaligned memory accesses
Use posix_memalign() with 16 bytes alignment request instead of
realloc() to guarantee 16 byte alignment requested by several
sysstat's structures.
Note: 16 byte alignment is no longer needed by sysstat's
structures. Yet removing the corresponding attributes
(__attribute__ ((aligned (16)))) for example in rd_stats.h
would imply a format change for sar/sadc binary data files.
These attributes will be removed when work is done to make sa binary
datafiles portable (see #135).
This is really a nasty point here. The fix should be to make sar and sadf
able to read both big and little-endian binary data files.
For now we just remove the problematic test cases.
The fill_file_menu() function was rewritten and tries to handle
all three possible formats (`saYYYYMMDD, `saDD', `YYYYMM/saDD')
by collecting existing log files into a temporary list of strings,
which is then used after being sorted to generate the menu.
NOTE: isag is no longer maintained. This patch has been provided by
Debian team (see #146).
Add Refresh button to file menu to make it possible to re-read contents
of sysstat directory in case isag is running over midnight, and new
file is created (LP: #924197).
NOTE: isag is no longer maintained. This patch has been provided by
Debian team (see #146).
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.