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.
This is because the total number of I/O operations is calculated as the sum
of operations for each filesystem/device mounted by the system. But if a
filesystem is unmounted, the total number of I/O operations may be lower
than its previous value, resulting in a negative number displayed by
sar. Display 0.0 in this case.
A note warning the user should probably go into the manual page too.
SVG: Fix how bar graphs are displayed for fs statistics
Comment in code stating that "bar graphs should not extend over previous
interval because %values are not calculated over a time interval but are
instantaneous values" is wrong. Doing this implies loosing the first
value and is not consistent with how bar graphs are displayed for other
activities.
Sebastien GODARD [Sat, 18 Jun 2016 15:59:24 +0000 (17:59 +0200)]
SVG: Fix "skipempty" option
When an activity is depicted by several views and option "skipempty" is
used, views with non zero values following a view which has been skipped
were also not displayed. Fix this here.
Also free memory for views which have been skipped.