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.
Breno Leitao [Mon, 31 Oct 2016 13:23:59 +0000 (09:23 -0400)]
sar: Improve cpuinfo read for POWER architecture
Currently CPU frequency is not being read properly on POWER archicture.
It shows the frequency as:
# sar -m CPU 1 5
...
06:30:28 AM CPU MHz
06:30:36 AM all 0.00
This is caused because /proc/cpuinfo is differently between Intel and
POWER.
This patch simply fix the parsing function (read_cpuinfo).
Update sar to display softnet statistics collected by sadc.
Also compute global statistics among all CPU (though these data are not
part of /proc/net/softnet_stat file).
Sebastien GODARD [Fri, 28 Oct 2016 14:48:07 +0000 (16:48 +0200)]
/proc/vmstat fix for Linux 4.8
The 4.8 kernel has some changes in /proc/vmstat which cause sysstat to
report zero values for {pgscank,pgscand}/s in sar -B. The attached
patch fixes this for 4.8 while retaining compatibility with older
kernels.
Sebastien GODARD [Fri, 21 Oct 2016 13:46:44 +0000 (15:46 +0200)]
mpstat, iostat: Use decimal point for FP values in JSON output
This patch sets LC_NUMERIC variable to "C" to make sure JSON output (as
displayed by mpstat and iostat commads) is locale-independent and
floating-point values use a decimal point.
This should make JSON output compliant with RFC7159.
Sebastien GODARD [Fri, 21 Oct 2016 12:52:04 +0000 (14:52 +0200)]
Fix #128: Use decimal point for FP values in JSON output
This patch sets LC_NUMERIC variable to "C" to make sure JSON output (as
displayed by sadf -j) is locale-independent and floating-point values
use a decimal point.
This should make JSON output compliant with RFC7159.
This patch read softnet statistics from the /proc/net/softnet_stat file.
Softnet stats will be collected by default by sadc: So set AO_COLLECTED
flag in corresponding activity structure.
Also metrics' type is unsigned int (%x) and not unsigned long long.
Sebastien GODARD [Fri, 14 Oct 2016 13:35:18 +0000 (15:35 +0200)]
sar: Add softnet statistics (part 1): Basic definitions and structures
Add new switch (-n SOFT) to sar. This option will tell sar to parse
/proc/net/softnet_stat file and display corresponding software-based
network processing statistics.
This first patch defines the needed structures, constants and functions
prototypes.
sar's help message is also updated.
pidstat: Use either short or full command line when looking for a pattern
Use either the command name string or the full command line when looking
for a substring with options -C or -G.
The full command line is used if option -l has been entered, otherwise we
use the short command name string.
Several buffers were used to hold timestamps, with different sizes
(sometimes 16, 32 or 64 characters).
Now define and use a single size for all of them (TIMESTAMP_LEN).
Michal Sekletar [Fri, 30 Sep 2016 16:05:44 +0000 (18:05 +0200)]
sar: make buffers that hold timestamps bigger
On systems that use Korean UTF-8 locale sar will not print timestamp
because there is not enough space in the buffer.
I bumped buffer size to 64 bytes because I figured out that 32 bytes is
still not enough to print out timestamp when using some glibc supported
locales.
$ LC_TIME=ko_KR.UTF-8 ./sar 1 1
Before:
Linux 4.7.2-201.fc24.x86_64 (morgoth.usersys.redhat.com) 2016년 09월 30일 _x86_64_ (4 CPU)
CPU %user %nice %system %iowait %steal %idle
all 4.51 0.00 2.51 0.00 0.00 92.98
Average: all 4.51 0.00 2.51 0.00 0.00 92.98
After:
Linux 4.7.2-201.fc24.x86_64 (morgoth.usersys.redhat.com) 2016년 09월 30일 _x86_64_ (4 CPU)
18시 18분 36초 CPU %user %nice %system %iowait %steal %idle
18시 18분 37초 all 3.76 0.00 2.26 0.00 0.00 93.98
Average: all 3.76 0.00 2.26 0.00 0.00 93.98
Fix #125: pidstat omits kernel threads when using -l option
When option -l is used with pidstat, kernel threads don't appear
in output. This is because the kernel thread's command line (as
read from /proc/#/cmdline) is empty and pidstat wrongly considered that
the thread had terminated. This patch fixes this.
Reported-by: Andrew Theurer Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
Sebastien GODARD [Sun, 28 Aug 2016 14:04:32 +0000 (16:04 +0200)]
Reuse hdr_line string for activities title line
Struct activity has a field named hdr_line which was used to display the
list of fields displayed by sadf -d.
Reuse it to display the periodic activity header line in sar's output.
Sebastien GODARD [Fri, 26 Aug 2016 07:30:05 +0000 (09:30 +0200)]
Fix #124: Conversion from older formats is broken
Commit 3c6fffd introduced a stricter check on file_magic->header_size
field. Yet this field exists only for files created with sysstat
versions 10.3.1 and later and so, should not be checked for older
versions. Trying to check it with older versions breaks the possibility
to convert (using sadf -c) a datafile created by such an old version.
Sebastien GODARD [Thu, 11 Aug 2016 07:13:57 +0000 (09:13 +0200)]
Replace strcpy() with strncpy() to avoid buffer overflows
Using strcpy() is not safe since destination buffer may overflow, for
example if the string being copied doesn't contain a terminator.
This patch replaces strcpy() with strncpy() to make sure no buffer
overflows happen.
Update graph title for network errors statistics (title was the same as
for network statistics).
Also update graph title for IPv4 network sockets (we have graphs for
IPv4 and IPv6 network sockets).
Add a new array (g_fields[]) used to determine the order in which the
metrics will be drawn. Used by save_extrema() function to save the min
and max values at the right position in spmin[]/spmax[] arrays.
Add a new array (g_type[]) giving the type of graphs that will be drawn
in each view (SVG_LINE_GRAPH, SVG_BAR_GRAPH). It makes it possible now
to call draw_activity_graphs() function only once even if there are
several types of graphs to draw.