Repository navigation
Conversation
Contributor
Author
|
CI/build failure for old versions of PCP - I'll fix that when I return from vacation. |
Contributor
Author
natoscott
force-pushed
the
pcp-read-write
branch
4 times, most recently
from
November 9, 2026 02:17
bebbcef to
73b12fe
Compare
| if (!WRITE_PCP_ONLY(flags)) { | ||
| /* Output path is chosen by the operator: not untrusted input. */ | ||
| /* codeql[cpp/path-injection] */ | ||
| open_ofile(&ofd, ofile, restart_mark); |
natoscott
force-pushed
the
pcp-read-write
branch
from
November 9, 2026 03:13
73b12fe to
6a13408
Compare
Contributor
Author
|
@sysstat remaining CodeQL alerts are pre-existing false positives (bounded strcpy in add_list_item(); user supplied sadc -o path) and inline suppressions are ignored by the PR check - could you take a look and dismiss them, or should I make some code changes to avoid/workaround these? |
natoscott
force-pushed
the
pcp-read-write
branch
from
November 13, 2026 03:41
6a13408 to
a59d2dc
Compare
Generic needs for PCP integration - time handling interface supporting nanosecond precision and keep in-memory disk read/write/discard counts for storing as individual PCP metrics (sadc normally aggregates them). Header file preparation for additional PCP code under HAVE_PCP macro. As a side-effect, use a single shared definition of dplaces_nr instead of accessing it in common.c and redefining it across several tools. Signed-off-by: Nathan Scott <[email protected]>
Implements PCP archive reading (sadf, sar, cifsiostat, iostat, mpstat, pidstat and tapestat) and writing (sadc -O), including a novel configurable local context PCP mechanism for sampling metrics (by name, via sysstat.pcpconf) which allows per-process metrics recording by sadc. Refactors pcp_def_metrics for more efficient lookups - avoid the string metric name mechanisms (linear search every time). Match with PCP package kernel metric names more accurately, especially relating to the disk/dm/md/zram naming convention. Implement new metrics for sadc to write relating to sysstat details (version, comments, interval, activities, and so on). Many more subtleties relating to matching the PCP code in sysstat up with the code in PCP itself improved - such as the load indoms matching exactly - these things improve the use of sadc PCP archives with PCP tools and grafana-pcp. Signed-off-by: Nathan Scott <[email protected]>
Signed-off-by: Nathan Scott <[email protected]>
Signed-off-by: Nathan Scott <[email protected]>
Signed-off-by: Nathan Scott <[email protected]>
PCP 7 bumped PMAPI to version 4, switching pmLogLabel, pmSetMode() and
pmResult timestamps from struct timeval to struct timespec, changed
pmiWrite() to take nanoseconds, and added PMI_APPEND plus a set of new
libpcp_import helpers.
Introduce pcp_compat.h, which aliases the high resolution PMAPI calls
(pmGetHighResArchiveLabel, pmSetModeHighRes, pmFetchHighRes,
pmFreeHighResResult) to the plain names when the headers predate
PMAPI_VERSION_4. Those interfaces have always carried struct timespec
timestamps, so no timeval conversion is needed and archive contents are
identical on both generations.
Features that have no older equivalent stay behind HAVE_PMI_APPEND:
local PMDA metrics, volume rotation, pmiExtraUnits() and
pmiSetImportProgram(). On older libpcp:
- pmiPutAtomValueHandle() is emulated with pmiPutValueHandle(), using
a handle-to-type registry populated when handles are created;
- __pmZoneinfo() is not exported, so pmimport.sadc.zoneinfo falls back
to the timezone recorded in the sa header;
- pmiWrite() is called with microsecond resolution.
pcp_write_uptime() no longer depends on HAVE_PMI_APPEND, so
sadf -O pcparchive keeps writing kernel.all.uptime and the derived
proc.psinfo.age/proc.hog.cpu metrics on PCP 6.2.
Also fix the IRQ handle wiring in pcp_def_irq_metrics(): slot numbers
must follow the item_list index (leaving a hole where "sum" is) to match
pcp_slot_for_item() in the write path; instance IDs stay dense.
Tests: PCP write tests are gated on HAVE_PMI_APPEND; 05616 writes
tests/pcpar-sadc for the read-only tests and 05628 removes it, instead
of leaving a PCP archive next to the native tests/sa18 where sar would
auto-select it. Fix 05627, which checked a file that was never
created. Add --from-code=UTF-8 to the xgettext invocation so the
UTF-8 comments in the PCP sources no longer abort the pot rule.
Signed-off-by: Nathan Scott <[email protected]>
The pot file was stale: it predated the PCP archive read/write changes, which added a number of new translatable strings. Regenerated with xgettext, now using --from-code=UTF-8. Signed-off-by: Nathan Scott <[email protected]>
natoscott
force-pushed
the
pcp-read-write
branch
from
November 18, 2026 23:21
a59d2dc to
e8cc3fb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This PR extends the existing Performance Co-Pilot (PCP) support in sysstat, optionally allowing sadc to write PCP archives as well (previously, only sadf wrote PCP archives).
A new sadc -O option is added. This provides three modes of recording in sadc:
You can switch between choices at any time, with no unexpected side-effects. Samples written to the PCP archives are recorded at sub-second precision (in nanoseconds).
A local-context mode of PCP sampling is introduced to extend sysstat metric coverage: any PCP shared library agent can supply groups of metrics (via a new configuration file), which sadc will then record along with the rest of its regular metrics.
Using this feature, recording of process metrics is enabled with -D XALL, as well as CIFS and tape metrics. 🎉
The pidstat, cifsstat, tapestat tools are updated to be able to replay these recorded metric groups. The mpstat and iostat tools are also updated to be able to report historical data from regular sadc CPU and disk activity groups. Hence, all sysstat tools can now replay recorded metrics.
The PCP code in sysstat is updated to use the more efficient handle-based PMI functions now.
This PR makes optional use of features recently added to PCP (version 7.2.0 or later) specifically to aid these sysstat features, which the ./configure process detects.
The core design here remains heavily based on discussions between @stevekay @sysstat and myself some time ago, however the local-context mode for recording additional PCP metrics is a more recent inspiration.
Resolves: #10, #11, #111, #220, #251, #407
Related: #93, #135, #251