PMCPP(1) | General Commands Manual | PMCPP(1) |
pmcpp - simple preprocessor for the Performance Co-Pilot
pmcpp [-Prs?] [-D name[=value] ...] [-I dir ...] [infile]
pmcpp provides a very simple pre-processor originally designed for manipulating Performance Metric Name Space (PMNS) files for the Performance Co-Pilot (PCP), but later generalized to provide conditional blocks, include file processing, in-line shell command execution and macro substitution for arbitrary files. It is most commonly used internally to process the PMNS file(s) after pmLoadNameSpace(3) or pmLoadASCIINameSpace(3) is called and to pre-process the configuration files for pmlogger(1).
Input lines are read from infile (or standard input if infile is not specified), processed and written to standard output.
All C-style comments of the form /* ... */ are stripped from the input stream.
There are no predefined macros for pmcpp although macros may be defined on the command line using the -D option, where name and value must follow the same rules as described below for the #define directive.
pmcpp accepts the following directives in the input stream (like cpp(1)):
Macro substitution is achieved by breaking the input stream into words separated by white space or characters that are not valid in a macro name, i.e. not alphanumeric and not underscore. Each word is checked and if it matches a macro name, the word is replaced by the macro value, otherwise the word is unchanged.
There is generally one output line for each input line, although the line may be empty if the text has been stripped due to the handling of comments or conditional directives. When there is a change in the input stream, an additional output line is generated of the form:
# lineno "filename"
to indicate the following line of output corresponds to line number lineno of the input file filename.
The available command line options are:
Important cpp(1) features that are not supported by pmcpp include:
Command: pmcpp | |
Input | Output |
# 1 "<stdin>" | |
#define MYDOMAIN 27 | |
root { | root { |
foo MYDOMAIN:0:0 | foo 27:0:0 |
} | } |
For the following examples, the file frequencies contains the lines:
%define dk_freq 1minute %define cpu_freq '15 sec'
Command: pmcpp -rs | |
Input | Output |
# get logging frequencies | # get logging frequencies |
# e.g. dk_freq macro | # e.g. dk_freq macro |
%include "frequencies" | |
log mandatory on %dk_freq { | log mandatory on 1minute { |
disk.dev | disk.dev |
} | } |
# note no % for want_cpu here | # note no % for want_cpu here |
%ifdef want_cpu | |
%define cpu_pfx 'kernel.all.cpu.' | |
log mandatory on %cpu_freq { | |
%{cpu_pfx}user | |
%{cpu_pfx}sys | |
} | |
%endif |
Command: pmcpp -rs -Dwant_cpu | |
Input | Output |
# get logging frequencies | # get logging frequencies |
# e.g. dk_freq macro | # e.g. dk_freq macro |
%include "frequencies" | |
log mandatory on %dk_freq { | log mandatory on 1minute { |
disk.dev | disk.dev |
} | } |
# note no % for want_cpu here | # note no % for want_cpu here |
%ifdef want_cpu | |
%define cpu_pfx 'kernel.all.cpu.' | |
log mandatory on %cpu_freq { | log mandatory on 15 sec { |
%{cpu_pfx}user | kernel.all.cpu.user |
%{cpu_pfx}sys | kernel.all.cpu.sys |
} | } |
%endif |
Environment variables with the prefix PCP_ are used to parameterize the file and directory names used by PCP. On each installation, the file /etc/pcp.conf contains the local values for these variables. The $PCP_CONF variable may be used to specify an alternative configuration file, as described in pcp.conf(5).
For environment variables affecting PCP tools, see pmGetOptions(3).
cpp(1), pmLoadASCIINameSpace(3), pmLoadNameSpace(3), pcp.conf(5), pcp.env(5) and PMNS(5).
Performance Co-Pilot |