]> granicus.if.org Git - sysstat/log
sysstat
6 years agosar/sadf: Change magic number for certain activities
Sebastien GODARD [Mon, 29 Jan 2018 17:02:51 +0000 (18:02 +0100)]
sar/sadf: Change magic number for certain activities

The format for some activities has changed in version 11.7.1.
Their magic number should have been updated. Fix this.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosadf: Rename option showhints to debug
Sebastien GODARD [Mon, 29 Jan 2018 17:00:53 +0000 (18:00 +0100)]
sadf: Rename option showhints to debug

Rename option showhints (used with sadf's option -O in RAW mode) to
debug since it is mainly used for debugging purpose.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosa_common.c: Use SYSSTAT_MAGIC constant instead of swapping bytes
Sebastien GODARD [Sat, 27 Jan 2018 06:52:11 +0000 (07:52 +0100)]
sa_common.c: Use SYSSTAT_MAGIC constant instead of swapping bytes

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoSave HZ as an unsigned long integer
Sebastien GODARD [Sat, 27 Jan 2018 06:47:55 +0000 (07:47 +0100)]
Save HZ as an unsigned long integer

Number of clock ticks per second is given as a long integer by sysconf()
function. It is also saved as an unsigned  long integer in sar's data
files (sa_hz).

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoiostat: Refresh device list properly
Sebastien GODARD [Mon, 22 Jan 2018 16:06:21 +0000 (17:06 +0100)]
iostat: Refresh device list properly

When running iostat to monitor disk activity,
disconnecting a USB drive from the system then reconnecting another one
didn't make the new one appear on the list.
This patch fixes the problem.

Reported-by: Robert Hoffmann <robert@noreply.servermasters.com>
Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoRAW: Check return code from check_*_reg functions
Sebastien GODARD [Sat, 20 Jan 2018 19:54:41 +0000 (20:54 +0100)]
RAW: Check return code from check_*_reg functions

Distinguish between new devices and devices that have been unregistered
then registered again (this indication is displayed by "sadf -r" with
showhints option).

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosar: Don't read statistics twice when displaying average since system
Sebastien GODARD [Fri, 19 Jan 2018 15:52:15 +0000 (16:52 +0100)]
sar: Don't read statistics twice when displaying average since system
startup

Entering something like "sar 0" to display statistics (here CPU) since
system startup made sadc read the statistics twice. One reading is
enough.
Before this patch, sar called sadc with interval=1 and count=-1.
Now sadc is called with interval=1 and count=1.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosar: Display all items for USB and filesystems activities
Sebastien GODARD [Fri, 19 Jan 2018 15:10:14 +0000 (16:10 +0100)]
sar: Display all items for USB and filesystems activities

The summary displayed by sar for USB and filesystems activities didn't
include all the items. In pacticular, filesystems or USB devices that
had been unmounted were not displayed in the summary ending the report.
This patch fixes the problem.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoUpdate README file
Sebastien GODARD [Fri, 19 Jan 2018 08:50:28 +0000 (09:50 +0100)]
Update README file

This is mainly cosmetic...

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoUpdate sysstat's FAQ
Sebastien GODARD [Fri, 19 Jan 2018 08:25:59 +0000 (09:25 +0100)]
Update sysstat's FAQ

Explain how to collect and save in data file only the desired
activities.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosar: Fix how activities are passed to sadc
Sebastien GODARD [Fri, 19 Jan 2018 08:23:32 +0000 (09:23 +0100)]
sar: Fix how activities are passed to sadc

Activities can no longer be passed by sar to sadc using numerical
values. Use activity names instead.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosadc: Select activities by name
Sebastien GODARD [Wed, 17 Jan 2018 20:26:56 +0000 (21:26 +0100)]
sadc: Select activities by name

This patch enables the user to select exactly which activities will be
collected by sadc and saved into the binary data file.
Selected activities are entered following sadc's option -S using their
formal report name (these names are displayed by "sar --help").

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosadf: Enhance "sadf -H" output
Sebastien GODARD [Wed, 17 Jan 2018 20:04:29 +0000 (21:04 +0100)]
sadf: Enhance "sadf -H" output

"sadf -H" now displays all the header data of the binary data file.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agocifsiostat: Display device name at the end of line when option -h used
Sebastien GODARD [Wed, 17 Jan 2018 20:02:28 +0000 (21:02 +0100)]
cifsiostat: Display device name at the end of line when option -h used

Same change here for cifsiostat that that applied to iostat.
See commit f65dc29.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoiostat: Display device name at the end of line when option -h used
Sebastien GODARD [Wed, 17 Jan 2018 19:49:49 +0000 (20:49 +0100)]
iostat: Display device name at the end of line when option -h used

iostat's option -h was intended to make the output more easily readable
by a human, especially when some devices had a long name that would make
the whole output shift around. In fact it added a '\n' to split the line
and the result was not particularly easier to read.
This patch moves the device name at the end of the line when option -h
is used without inserting more lines.
Option -h still sets option --human to automatically select the right
unit to display.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosar: Update help message
Sebastien GODARD [Wed, 17 Jan 2018 19:46:08 +0000 (20:46 +0100)]
sar: Update help message

Update message displayed by "sar --help": Print the report name
associated with each activity.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoUpdate sysstat's FAQ
Sebastien GODARD [Mon, 15 Jan 2018 17:00:04 +0000 (18:00 +0100)]
Update sysstat's FAQ

Add reference to sarjitsu application.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoAdd a comment with a warning in rd_stats.h
Sebastien GODARD [Mon, 15 Jan 2018 16:42:40 +0000 (17:42 +0100)]
Add a comment with a warning in rd_stats.h

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosadf: RAW: Display activity name when showhints option used
Sebastien GODARD [Mon, 15 Jan 2018 16:38:27 +0000 (17:38 +0100)]
sadf: RAW: Display activity name when showhints option used

"sadf -r -O showhints..." now displays the name for each activity.
Also move the code displaying the number of structures used and allocated
from raw_stats.c to sadf.c.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosar: Change some activities' name
Sebastien GODARD [Mon, 15 Jan 2018 16:34:53 +0000 (17:34 +0100)]
sar: Change some activities' name

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoStarting sysstat 11.7.2
Sebastien GODARD [Fri, 12 Jan 2018 11:16:52 +0000 (12:16 +0100)]
Starting sysstat 11.7.2

Update sysstat version number in configure script.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosysstat-11.7.1 v11.7.1
Sebastien GODARD [Fri, 12 Jan 2018 10:56:29 +0000 (11:56 +0100)]
sysstat-11.7.1

sysstat version 11.7.1 final packaging.
lsm and spec files updated.
Changelog added.

NOTE: Stable versions (11.2.14 [EOL], 11.4.8 and 11.6.2) also exist
and will be available for download from my web site:

http://pagesperso-orange.fr/sebastien.godard/

The stable versions include only the bug fixes added in sysstat 11.7.1
but not the new features.

Version 11.7.1 includes major changes concerning sar's binary data
file format and how sar works. Among them:

* A binary data file should take much less space on disk thanks
to new optimizations on how values are stowed in memory. The space saved
is estimated at least at 25% compared to previous format.

* Structures are no longer statically allocated, meaning that
the system can now register as many new devices (disks, network
interfaces, etc.) as needed and you will find all of them saved in your
saXX data file (provided that you have selected the corresponding
activities to collect). Previous version could lead to some devices
being ignored and going unnoticed if no free structures were left.

* Sar (and sadf) will now be able to read a binary data file
whatever its endianness is: Both big-endian and little-endian files can
be read by the same sar or sadf executable.

* More flexibility has been added to sar's binary data file
format. I cannot promise that the format won't change again in the
future but it should now be possible to add new metrics or activities
without making the format unreadable by older sar versions (starting
with version 11.7.1). Older versions will be able to read newer formats
but will display only the metrics they currently know.

Version 11.7.1 is a development version. As such, it is still NOT ready
for use in production. Yet I would really like to have it tested by the
maximum number of users and get feedback! :-)

NOTE: The function provided by sadf (option -c) to convert an old
data file to the up-to-date format has been temporarily inhibited. This
function will be working again in next sysstat version (11.7.2).

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoNLS updated
Sebastien GODARD [Fri, 12 Jan 2018 10:55:00 +0000 (11:55 +0100)]
NLS updated

Various translations updated.
Removed lsm and spec files.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoUpdate sar's manual page
Sebastien GODARD [Fri, 12 Jan 2018 09:18:09 +0000 (10:18 +0100)]
Update sar's manual page

Reference new option -h.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosar: Add new option -h
Sebastien GODARD [Fri, 12 Jan 2018 09:15:40 +0000 (10:15 +0100)]
sar: Add new option -h

Add option -h to make sar's output easier to read by a human.
This option tells sar to display {devices, network interfaces} names at
the end of the line to make sure the output won't shift. This option
also enables implicitly --human and -p (pretty-print).

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoUpdate sar manual page
Sebastien GODARD [Fri, 12 Jan 2018 08:37:58 +0000 (09:37 +0100)]
Update sar manual page

Option -h has been renamed to --help.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosar: Rename option -h to --help
Sebastien GODARD [Fri, 12 Jan 2018 08:35:20 +0000 (09:35 +0100)]
sar: Rename option -h to --help

Option --help displays a help message.
Option -h will be used to make sar's output easier to read by a human.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoSVG: Put queue and load average metrics back in order
Sebastien GODARD [Mon, 8 Jan 2018 16:54:19 +0000 (17:54 +0100)]
SVG: Put queue and load average metrics back in order

Commit 4a15362 changed the order of metrics in stats_queue structure.
This new order has also to be taken into account by corresdponding
rendering function in svg_stats.c.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoFiles dependencies: Global update
Sebastien GODARD [Sun, 7 Jan 2018 16:33:50 +0000 (17:33 +0100)]
Files dependencies: Global update

Update files included in source files.
Update Makefile to be consistent with files dependencies.
Move also some code from common.c to rd_stats.c.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoSmall fix in manual pages
Sebastien GODARD [Sun, 7 Jan 2018 11:07:34 +0000 (12:07 +0100)]
Small fix in manual pages

There is always one decimal place in numbers displayed with --human
option.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoVarious cosmetic changes
Sebastien GODARD [Sun, 7 Jan 2018 10:55:40 +0000 (11:55 +0100)]
Various cosmetic changes

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosar/sadf: Fix dependencies in Makefile
Sebastien GODARD [Sun, 7 Jan 2018 10:48:10 +0000 (11:48 +0100)]
sar/sadf: Fix dependencies in Makefile

File activity.c should depend on rd_stats.h and rd_sensors.h
for sadf and sar in addition to sadc.
Structures size (STATS_*_SIZE) is defined in these include files and
used in activity.c for all commands.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosar: Fix how stats are displayed since boot time for some activities
Sebastien GODARD [Fri, 5 Jan 2018 10:55:38 +0000 (11:55 +0100)]
sar: Fix how stats are displayed since boot time for some activities

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosadf: Update functions to display unsigned unsigned long values
Sebastien GODARD [Fri, 5 Jan 2018 10:44:35 +0000 (11:44 +0100)]
sadf: Update functions to display unsigned unsigned long values

Some metrics's type is now unsigned long long instead of unsigned long.
So update functions used by sadf accordingly. Other metrics whose type
remains unsigned long can still be displayed.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosar: Update functions to be consistent with new stats structures
Sebastien GODARD [Mon, 1 Jan 2018 15:46:04 +0000 (16:46 +0100)]
sar: Update functions to be consistent with new stats structures

Update functions used to read or write statistics to remain consistent
with structures' new types.
Some work has still to be done in rndr_stats.c and svg_stats.c

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosar: Update statistics structures
Sebastien GODARD [Mon, 1 Jan 2018 15:43:54 +0000 (16:43 +0100)]
sar: Update statistics structures

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosar: Fix code trying to guess when a header line needs to be displayed
Sebastien GODARD [Sun, 31 Dec 2017 14:35:00 +0000 (15:35 +0100)]
sar: Fix code trying to guess when a header line needs to be displayed

sar should repeat the header line for each activity at regular intervals
when displaying stats from file.
The code previously used needs to be updated as the number of items may
now vary with each sample.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosar: Print items' name on the right of the report
Sebastien GODARD [Sun, 31 Dec 2017 08:32:33 +0000 (09:32 +0100)]
sar: Print items' name on the right of the report

Some items' name (devices, network interfaces) may sometimes be long
enough to create a shift in the statistics displayed by sar which are no
longer in their original column.
So display them at the end of the line on the right.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosadf -H: Display all the activities in file
Sebastien GODARD [Sun, 31 Dec 2017 08:13:09 +0000 (09:13 +0100)]
sadf -H: Display all the activities in file

Make sadf -H display all the activities present in file, whether known
or unknown.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosadc: Fix segfault that may happen when appending data to file
Sebastien GODARD [Sat, 30 Dec 2017 10:16:32 +0000 (11:16 +0100)]
sadc: Fix segfault that may happen when appending data to file

Buffers need to be allocated according to activities present in file so
that we can append data to that file.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoFix alg used to find pair of matching items
Sebastien GODARD [Thu, 28 Dec 2017 20:33:17 +0000 (21:33 +0100)]
Fix alg used to find pair of matching items

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosadc.c: Fix number of items passed to sar
Sebastien GODARD [Wed, 27 Dec 2017 13:24:11 +0000 (14:24 +0100)]
sadc.c: Fix number of items passed to sar

When appending data to a file, the number of items passed by sadc to sar
cannot be 0 for any activity.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosadc.c: Stop if no activities are collected
Sebastien GODARD [Wed, 27 Dec 2017 13:18:05 +0000 (14:18 +0100)]
sadc.c: Stop if no activities are collected

Don't collect CPU stats by default if no other activities are collected:
sadc now stops in this case.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosadf: Don't test for activities available in file if only the header
Sebastien GODARD [Tue, 26 Dec 2017 15:56:15 +0000 (16:56 +0100)]
sadf: Don't test for activities available in file if only the header
needs to be displayed

When "sadf -H" is used, there is no need to check that activities exist
in file. This is all the more true now as even CPU statistics (A_CPU
activity) don't necessarily exist in file.
E.g.:
sadc -S 0,36 datafile 1 2
Then "sadf -H datafile" should not display error message "Requested
activities not available in file".

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosadf: RAW: Display number of allocated slots for current activity
Sebastien GODARD [Tue, 26 Dec 2017 15:53:27 +0000 (16:53 +0100)]
sadf: RAW: Display number of allocated slots for current activity

Enhance output displayed by sadf in raw mode (sadf -r) again: If
showhints option is used, display number of allocated slots for items
for current activity sample.
Mainly useful for debugging purpose, as this value is not saved in file.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosadc: Fix segfault happening when buffer needs to be reallocated
Sebastien GODARD [Tue, 26 Dec 2017 15:27:23 +0000 (16:27 +0100)]
sadc: Fix segfault happening when buffer needs to be reallocated

reallocate_buffer() in sa_wrap.c assigns a new address to a->_buf0
buffer. This new address needs also to be set to the variable pointing
to the statistics structure in parent function.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoFix typo / Cosmetic change
Sebastien GODARD [Tue, 26 Dec 2017 15:26:19 +0000 (16:26 +0100)]
Fix typo / Cosmetic change

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoRemove dead code in rd_stats.c
Sebastien GODARD [Tue, 26 Dec 2017 15:25:11 +0000 (16:25 +0100)]
Remove dead code in rd_stats.c

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoDon't count CPU "all" twice when displaying a RESTART message
Sebastien GODARD [Sun, 24 Dec 2017 16:06:08 +0000 (17:06 +0100)]
Don't count CPU "all" twice when displaying a RESTART message

file_hdr->sa_cpu_nr already includes CPU "all", so don't increment its
number when setting nr_ini variable.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosadf: RAW: Display number of items for current activity
Sebastien GODARD [Sun, 24 Dec 2017 16:03:33 +0000 (17:03 +0100)]
sadf: RAW: Display number of items for current activity

Enhance output displayed by sadf in raw mode (sadf -r): If showhints
option is used, display number of items read for current activity
sample.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosadf: ppc: Remove duplicate % sign
Sebastien GODARD [Sun, 24 Dec 2017 15:14:01 +0000 (16:14 +0100)]
sadf: ppc: Remove duplicate % sign

In some cases, the % sign was printed twice by sadf -p, e.g.:

$ sadf -p test_file
test.home 1 2017-12-24 14:52:39 UTC all %%user 0.25
test.home 1 2017-12-24 14:52:39 UTC all %%nice 0.00
test.home 1 2017-12-24 14:52:39 UTC all %%system 0.25
test.home 1 2017-12-24 14:52:39 UTC all %%iowait 0.00
test.home 1 2017-12-24 14:52:39 UTC all %%steal 0.00
test.home 1 2017-12-24 14:52:39 UTC all %%idle 99.50

Expected result:

$ sadf -p test_file
test.home 1 2017-12-24 14:52:39 UTC all %user 0.25
test.home 1 2017-12-24 14:52:39 UTC all %nice 0.00
test.home 1 2017-12-24 14:52:39 UTC all %system 0.25
test.home 1 2017-12-24 14:52:39 UTC all %iowait 0.00
test.home 1 2017-12-24 14:52:39 UTC all %steal 0.00
test.home 1 2017-12-24 14:52:39 UTC all %idle 99.50

Problem was triggered by commit 5431b6c.
This patch fixes it.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoSVG: Display time as xx:00 instead of xxH when oneday option used
Sebastien GODARD [Sat, 23 Dec 2017 16:47:19 +0000 (17:47 +0100)]
SVG: Display time as xx:00 instead of xxH when oneday option used

Timestamps were displayed as 0H 2H ... 22H for graphs created with a
command like "sadf -g -O oneday...".
They are now displayed as 0:00 2:00 ... 22:00

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoA_SERIAL: Don't increment serial line number before saving
Sebastien GODARD [Sat, 23 Dec 2017 16:04:21 +0000 (17:04 +0100)]
A_SERIAL: Don't increment serial line number before saving

The line number, as saved in the stats_serial structure, was used to
determine if the structure was empty or not: A value of 0 used to mean
that the structure was actually empty. As a consequence line #0 was
saved with the value 1, line #1 was saved with the value 2, etc.
This is no longer useful as structures are now dynamically allocated and
we know exactly how many of them we have.
So save now the real line number.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosadf.c: Simplify code
Sebastien GODARD [Sat, 23 Dec 2017 15:52:12 +0000 (16:52 +0100)]
sadf.c: Simplify code

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosadf: Update sadf to handle new file's binary format
Sebastien GODARD [Fri, 22 Dec 2017 17:16:43 +0000 (18:16 +0100)]
sadf: Update sadf to handle new file's binary format

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosa_conv.c: Inhibit conversion function
Sebastien GODARD [Fri, 22 Dec 2017 17:07:36 +0000 (18:07 +0100)]
sa_conv.c: Inhibit conversion function

sadf's option -c, used to convert an old datafile to up-to-date format,
is temporarily inhibited.
sysstat 11.7.1 datafiles have a new binary format and this function
needs to be rewritten. Yet I don't want to delay 11.7.1 release too
much.
This function will be restored in next sysstat release.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agopr_stats.c: Cosmetic change in code
Sebastien GODARD [Fri, 22 Dec 2017 17:06:23 +0000 (18:06 +0100)]
pr_stats.c: Cosmetic change in code

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosadc/sar: New format (part 7): Allocate structures dynamically
Sebastien GODARD [Fri, 22 Dec 2017 07:49:56 +0000 (08:49 +0100)]
sadc/sar: New format (part 7): Allocate structures dynamically

The goal of this patch is to make sar and sadc able to deal with any
number of devices which may be registered by the system, even if this
number is much higher than the intial one when the datafile was created.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosadf: Get rid of id_g_nr variable
Sebastien GODARD [Mon, 18 Dec 2017 18:10:09 +0000 (19:10 +0100)]
sadf: Get rid of id_g_nr variable

Previous commit didn't completely remove reference to id_g_nr variable.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoSVG: Don't compute number of SVG graphs for each activity
Sebastien GODARD [Mon, 18 Dec 2017 16:00:37 +0000 (17:00 +0100)]
SVG: Don't compute number of SVG graphs for each activity

We only need the total number of rows containing SVG views for all the
activities, not a number for each of them.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoUse ULLONG_MAX/2 to check if network device counters have overflown
Sebastien GODARD [Sat, 16 Dec 2017 09:41:10 +0000 (10:41 +0100)]
Use ULLONG_MAX/2 to check if network device counters have overflown

Counters's type for stats_net_dev structure is "unsigned long long"
(it used to be "unsigned long" before). So use ULLONG_MAX instead of
ULONG_MAX to try to guess if counters have overflown.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosadf: Don't use an array for tot_jiffies variable
Sebastien GODARD [Sat, 16 Dec 2017 09:24:25 +0000 (10:24 +0100)]
sadf: Don't use an array for tot_jiffies variable

See commit 624374b.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoWorkaround for offline CPU coming back online
Sebastien GODARD [Sat, 16 Dec 2017 08:29:21 +0000 (09:29 +0100)]
Workaround for offline CPU coming back online

I noticed that whith recent kernels, when a CPU comes back online, some
fields (user, nice, system) restart from their previous value, whereas
others (idle, iowait) restart from zero. For values restarting from
zero, we need to set their previous value to zero to avoid getting an
interval value < 0.
We try also to guess if the counters have overflown: If the previous
value was greater than ULLONG_MAX & 0x80000, then the CPU was probably
not set offline but the counter overflew (the value 0x80000 is an
arbitrary limit that I decided to use).

See example below:

4.4.14-200.fc22.x86_64

cpu  8123 235 3359 1099139 15985 0 14 0 0 0
cpu0 1591 89 839 142345 6345 0 13 0 0 0
cpu1 1134 57 686 147160 2903 0 0 0 0 0
cpu2 1179 22 490 148289 1965 0 0 0 0 0
cpu3 1208 36 408 95477 25 0 0 0 0 0 <<<<<
cpu4 628 25 286 117308 250 0 0 0 0 0
cpu5 1122 1 260 149389 1263 0 0 0 0 0
cpu6 386 1 166 149943 1532 0 0 0 0 0
cpu7 871 0 222 149224 1698 0 0 0 0 0

cpu  8146 235 3374 1168377 18919 0 14 0 0 0
cpu0 1594 89 843 144632 6348 0 13 0 0 0
cpu1 1138 57 689 149455 2907 0 0 0 0 0
cpu2 1186 22 493 150585 1965 0 0 0 0 0
cpu4 629 25 286 119612 253 0 0 0 0 0
cpu5 1123 1 261 151693 1263 0 0 0 0 0
cpu6 386 1 166 152250 1532 0 0 0 0 0
cpu7 875 0 223 151526 1698 0 0 0 0 0

cpu  8169 236 3391 1033989 15978 0 14 0 0 0
cpu0 1598 89 847 146554 6354 0 13 0 0 0
cpu1 1143 57 692 151389 2910 0 0 0 0 0
cpu2 1192 23 497 152517 1965 0 0 0 0 0
cpu3 1213 36 411 677 0 0 0 0 0 0 <<<<<
cpu4 632 25 288 121553 253 0 0 0 0 0
cpu5 1125 1 262 153636 1263 0 0 0 0 0
cpu6 387 1 167 154193 1532 0 0 0 0 0
cpu7 877 0 224 153468 1698 0 0 0 0 0

In the example above, idle value for CPU#3 is 95477 before CPU is set
offline, then 677 when it has come back online, and iowait value goes
from 25 to 0.
On the other hand, user value for example goes from 1208 to 1213...
(We can also notice that values given for global CPU usage on the first
line have a really strange behavior...)

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosar: Define new AO_COUNTED and AO_PERSISTENT flags
Sebastien GODARD [Wed, 13 Dec 2017 14:48:42 +0000 (15:48 +0100)]
sar: Define new AO_COUNTED and AO_PERSISTENT flags

See comments in code for explanations of these flags.
AO_PERSISTENT is for a later use.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agopr_stats.c: Don't use an array for tot_jiffies variable
Sebastien GODARD [Wed, 13 Dec 2017 07:47:49 +0000 (08:47 +0100)]
pr_stats.c: Don't use an array for tot_jiffies variable

We don't need 3 variables, only 2 are enough.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoUpdate Makefile
Sebastien GODARD [Sun, 10 Dec 2017 09:01:17 +0000 (10:01 +0100)]
Update Makefile

Make rd_sensors.o depend on rd_stats.h include file.
rd_stats.h defines __nr_t type which is used by rd_sensors files.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoAdd stdlib.h include file in common.h
Sebastien GODARD [Sun, 10 Dec 2017 08:50:41 +0000 (09:50 +0100)]
Add stdlib.h include file in common.h

This is needed to define realloc() function used by SREALLOC() macro.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosar: A_PWR_CPUFREQ activity: Don't display offline CPU
Sebastien GODARD [Sun, 10 Dec 2017 08:42:02 +0000 (09:42 +0100)]
sar: A_PWR_CPUFREQ activity: Don't display offline CPU

Offline processors won't be displayed any more in sar/sadc output.
Start here with A_PWR_CPUFREQ activity.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosar/sadc: Make use of __nr_t type
Sebastien GODARD [Sun, 10 Dec 2017 08:35:16 +0000 (09:35 +0100)]
sar/sadc: Make use of __nr_t type

__nr_t type (which defaults to int) is used to define a number of items
(devices, network interfaces, etc.) So use it instead of int in various
places.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosar: Enhance print_read_error() function
Sebastien GODARD [Sun, 10 Dec 2017 08:08:45 +0000 (09:08 +0100)]
sar: Enhance print_read_error() function

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosar: No need to init previous iteration structure when a device has been
Sebastien GODARD [Sat, 9 Dec 2017 08:43:33 +0000 (09:43 +0100)]
sar: No need to init previous iteration structure when a device has been
registered again

Simplify code a bit: Don't reset previous iteration's statistics when a
known device has been registered again, since this is already done when
stats are displayed.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoFix #168: sadf: Fix CSV output for TTY statistics
Sebastien GODARD [Sat, 9 Dec 2017 08:08:07 +0000 (09:08 +0100)]
Fix #168: sadf: Fix CSV output for TTY statistics

The TTY number was repeated before each field value in CSV output
display by sadf:

ubuntu;10;2017-09-29 12:00:31 UTC;0;0.00;0;0.00;0;0.00;0;0.00;0;0.00;0;0.00
ubuntu;10;2017-09-29 12:00:31 UTC;1;0.00;1;0.00;1;0.00;1;0.00;1;0.00;1;0.00

Expected output:

ubuntu;10;2017-09-29 12:00:31 UTC;0;0.00;0.00;0.00;0.00;0.00;0.00
ubuntu;10;2017-09-29 12:00:31 UTC;1;0.00;0.00;0.00;0.00;0.00;0.00

This patch fixes the problem.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agopr_stats.c: Simplify code a bit
Sebastien GODARD [Mon, 4 Dec 2017 17:30:07 +0000 (18:30 +0100)]
pr_stats.c: Simplify code a bit

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosar/sadc: Get rid of volatile activities
Sebastien GODARD [Fri, 17 Nov 2017 13:37:09 +0000 (14:37 +0100)]
sar/sadc: Get rid of volatile activities

So called "volatile activities" were activities for which the number of
items could vary and corresponding structures were reallocated
accordingly.
In fact only A_CPU activity (CPU statistics) was volatile, to take into
account a possible restart of a VM machine including more CPU than when
the datafile was created.
The goal is now to allocate dynamically all the structures used by
activities, so we no longer have to distinguish between activities which
are volatile or not.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosar/sadc: Don't assume CPU statistics are always recorded in file
Sebastien GODARD [Fri, 17 Nov 2017 08:33:50 +0000 (09:33 +0100)]
sar/sadc: Don't assume CPU statistics are always recorded in file

CPU statistics were always collected and saved when a saDD datafile was
created. Those statistics were in particular used to compute time
interval in jiffies, and to give the number of processors of the machine
(which was displayed in the report header).

We no longer use CPU jiffies to compute time interval (which is now
expressed in 1/100th of a second and calculated using the /proc/uptime
file). So CPU statistics are no longer compulsory: They may not be
collected and available in file.
Since we always need a way to know the number of CPU of the machine
where the data file has been created, we add a new field (sa_cpu_nr) in
the file_header structure.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoRemove unused cpu_nr parameter from functions
Sebastien GODARD [Mon, 13 Nov 2017 15:49:03 +0000 (16:49 +0100)]
Remove unused cpu_nr parameter from functions

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoRemove prealloc.h from .gitignore file
Sebastien GODARD [Mon, 13 Nov 2017 14:07:30 +0000 (15:07 +0100)]
Remove prealloc.h from .gitignore file

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosar/sadc: Increase devices upper limits
Sebastien GODARD [Sun, 12 Nov 2017 09:14:20 +0000 (10:14 +0100)]
sar/sadc: Increase devices upper limits

We found that previous upper limits values were too low sometimes (e.g.
512 for the maximum number of network interfaces). So increase them.

(Upper limits exist to make sure we don't allocate unreasonably high
amount of memory to save devices statistics, in particular when we read
data from a -possibly- corrupted datafile).

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosar/sadc: Remove preallocation constants
Sebastien GODARD [Sun, 12 Nov 2017 08:17:55 +0000 (09:17 +0100)]
sar/sadc: Remove preallocation constants

Next sysstat version will dynamically allocate records for new devices
when they are registered by the system. So we no longer need to
preallocate those records.
This patch removes the constants and files that were used for this
purpose.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosadc: Fix file_header structure composition
Sebastien GODARD [Wed, 1 Nov 2017 08:54:40 +0000 (09:54 +0100)]
sadc: Fix file_header structure composition

The new sa_hz member in file_header structure adds one unsigned long
integer to structure's composition.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosadc: Save HZ value in sa datafile header
Sebastien GODARD [Sun, 22 Oct 2017 10:03:35 +0000 (12:03 +0200)]
sadc: Save HZ value in sa datafile header

This parameter gives the number of jiffies per second on the machine
that created the file. It is now saved in file's header.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoRemove unused parameters passed to functions
Sebastien GODARD [Sat, 21 Oct 2017 15:03:51 +0000 (17:03 +0200)]
Remove unused parameters passed to functions

Some variables were passed to functions but unused by them. So remove
them.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoHZ value is no longer needed in several sysstat commands
Sebastien GODARD [Sat, 21 Oct 2017 14:45:09 +0000 (16:45 +0200)]
HZ value is no longer needed in several sysstat commands

So don't pick up its value.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoUse a time interval expressed in seconds, not in jiffies
Sebastien GODARD [Sat, 21 Oct 2017 14:13:35 +0000 (16:13 +0200)]
Use a time interval expressed in seconds, not in jiffies

Now use a time interval expressed in 1/100th of a second instead of
jiffies to calculate statistics. This is independent of the machine.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoDon't compute global system uptime when reading CPU stats
Sebastien GODARD [Fri, 13 Oct 2017 12:20:30 +0000 (14:20 +0200)]
Don't compute global system uptime when reading CPU stats

Don't compute "global system uptime" (i.e. total number of jiffies spent
by all processors) in read_stat_cpu() function so that we don't have to
pass the result from one function to another.
Global system uptime is used only when displaying CPU statistics, so
this is now done locally in the functions displaying CPU statistics.
Also as a consequence, field uptime has been removed from the
record_header structure associated with every sample statistics in
sar/sadc.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoNo longer use /proc/stat to calculate system uptime
Sebastien GODARD [Fri, 13 Oct 2017 07:29:19 +0000 (09:29 +0200)]
No longer use /proc/stat to calculate system uptime

sysstat commands used the /proc/stat file to compute system uptime based
on the number of jiffies spent by CPU#0 (which cannot be set offline).
Now only use the /proc/uptime file which we assume always exists on a
Linux machine.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosadf: Don't test for nr2 field value to display it
Sebastien GODARD [Sat, 7 Oct 2017 14:54:12 +0000 (16:54 +0200)]
sadf: Don't test for nr2 field value to display it

Testing for AO_MATRIX flag should be just enough for sadf -H to display
nr2 value.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosadf: Don't use f_count2() function pointer
Sebastien GODARD [Wed, 4 Oct 2017 07:51:09 +0000 (09:51 +0200)]
sadf: Don't use f_count2() function pointer

activity structure's f_count2() member (used to count the number of
sub-items) was tested in sadf.c but never initialized (its value is
initialized only when sadc.c is compiled, not sadf.c). So use a specific
flag to indicate if activity has sub-items instead of testing f_count2()
value.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosadc/sar: New format (part 6): Remap other structures
Sebastien GODARD [Wed, 4 Oct 2017 07:25:55 +0000 (09:25 +0200)]
sadc/sar: New format (part 6): Remap other structures

Remap file_activity and record_header structures from an older (or
newer) sysstat version to current sysstat version's format.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosa.h: Fix functions prototype
Sebastien GODARD [Sat, 30 Sep 2017 07:34:02 +0000 (09:34 +0200)]
sa.h: Fix functions prototype

Fix remap_struct() and swap_struct() prototypes according to commit
ad4fe0f.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosadc/sar: New format (part 5): Remap file_header structure
Sebastien GODARD [Mon, 25 Sep 2017 15:39:17 +0000 (17:39 +0200)]
sadc/sar: New format (part 5): Remap file_header structure

Remap file_header structure from an older (or newer) sysstat version to
current format (from current sysstat version).

file_header is one the structure composing the header of a binary data
file.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoFortify use of structures map
Sebastien GODARD [Sun, 24 Sep 2017 16:16:35 +0000 (18:16 +0200)]
Fortify use of structures map

Add extra checks on *_types_nr[] values read from a file to cope with
possible corrupted files.
*_types_nr[] values give the number of fields of each type (long long,
long, int) composing a structure.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosadc: Append data only to strictly compliant files
Sebastien GODARD [Sun, 24 Sep 2017 15:26:17 +0000 (17:26 +0200)]
sadc: Append data only to strictly compliant files

The rule is that sar/sadc should only append data to datafile whose
format is strictly that expected by current sysstat version.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosar: Add further comments in code
Sebastien GODARD [Sun, 24 Sep 2017 15:03:07 +0000 (17:03 +0200)]
sar: Add further comments in code

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoMakefile: Remove old nfsiostat files
Sebastien GODARD [Sun, 24 Sep 2017 09:59:59 +0000 (11:59 +0200)]
Makefile: Remove old nfsiostat files

Make sure that no references to nfsiostat files exist.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosadc/sar: New format (part 4): Update file_magic structure
Sebastien GODARD [Fri, 22 Sep 2017 12:18:12 +0000 (14:18 +0200)]
sadc/sar: New format (part 4): Update file_magic structure

Use integer type for upgraded field instead of unsigned char in
file_magic structure. Thus we are no longer limited to 15 for the
patchlevel and sublevel version numbers.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosadc/sar: New format (part 3): Use 64-bit time fields
Sebastien GODARD [Fri, 22 Sep 2017 07:27:01 +0000 (09:27 +0200)]
sadc/sar: New format (part 3): Use 64-bit time fields

Now use unsigned long long type for time fields (instead of
unsigned long, which are only 32-bit wide on 32-bit systems).
This is to avoid any future problems (like year 2038 integer
overflow).
Also code the year number as an integer instead of a char in datafile's
header.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosadc/sar: New format (part 2): Remap statistics structures
Sebastien GODARD [Fri, 22 Sep 2017 06:40:38 +0000 (08:40 +0200)]
sadc/sar: New format (part 2): Remap statistics structures

Remap structures containing statistics from an older (or newer)
sysstat version to current format (from current sysstat version).

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agoAdd function to remap a structure
Sebastien GODARD [Fri, 22 Sep 2017 06:33:13 +0000 (08:33 +0200)]
Add function to remap a structure

This function will be used to map two structures from two
different sysstat versions.
It will thus be possible to add new fields, e.g., in structures
containing statistics and still be possible for another sysstat version
to read its contents properly.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
6 years agosar/sadf: On-the-fly endianness conversion
Sebastien GODARD [Sun, 17 Sep 2017 08:54:34 +0000 (10:54 +0200)]
sar/sadf: On-the-fly endianness conversion

This patch aims at making sar and sadf able to read and process files
created on machines with a different endian type. It will now be
possible e.g., to read a file with sar on a little-endian machine even
if this has been created on a big-endian machine.
Yet it will still not be allowed to append (write) data with sar to a
file with a different endianness type.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>