формат архива показателей производительности (performance metrics archive format)
COMMON FEATURES
All three types of files have a similar record-based structure, a
convention of network-byte-order (big-endian) encoding, and
32-bit fields for tagging/padding for those records. Strings are
stored as 8-bit characters without assuming a specific encoding,
so normally ASCII. See also the __pmLog*
types in libpcp.h.
RECORD FRAMING
The volume and meta files are divided into self-identifying
records.
┌───────┬────────┬─────────────────────────────────────────────────────┐
│Offset │ Length │ Name │
├───────┼────────┼─────────────────────────────────────────────────────┤
│ 0 │ 4 │ N, length of record, in bytes, including this field │
│ 4 │ N-8 │ record payload, usually starting with a 32-bit tag │
│ N-4 │ 4 │ N, length of record (again) │
└───────┴────────┴─────────────────────────────────────────────────────┘
ARCHIVE LOG LABEL
All three types of files begin with a "log label" header, which
identifies the host name, the time interval covered, and a time
zone.
┌───────┬────────┬────────────────────────────────────────────────────┐
│Offset │ Length │ Name │
├───────┼────────┼────────────────────────────────────────────────────┤
│ 0 │ 4 │ tag, PM_LOG_MAGIC | PM_LOG_VERS02=0x50052602 │
│ 4 │ 4 │ pid of pmlogger process that wrote file │
│ 8 │ 4 │ log start time, seconds part (past UNIX epoch) │
│ 12 │ 4 │ log start time, microseconds part │
│ 16 │ 4 │ current log volume number (or -1=.meta, -2=.index) │
│ 20 │ 64 │ name of collection host │
│ 80 │ 40 │ time zone string ($TZ environment variable) │
└───────┴────────┴────────────────────────────────────────────────────┘
All fields, except for the current log volume number field, match
for all archive-related files produced by a single run of the
tool.