This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Performance Co-Pilot (PCP) is a mature, extensible, cross-platform toolkit for system-level performance monitoring and management. It provides a unifying abstraction for all performance data in a system and many tools for interrogating, retrieving and processing that data.
# Configure and build from source (requires autotools)
./configure --prefix=/usr --libexecdir=/usr/lib --sysconfdir=/etc --localstatedir=/var
make
# Build packages for the current platform
./Makepkgs --verbose
# Cross-compile for Windows (requires MinGW)
./Makepkgs --verbose --target mingw64
# Install manually after building
sudo make install# Run QA setup validation
qa/admin/check-vm
# Install dependencies for your platform
qa/admin/list-packages -m
# Run all QA tests
cd qa && ./check
# Run specific tests
cd qa && ./check 000 # Run test 000
cd qa && ./check 100-200 # Run tests 100-200
cd qa && ./check -g pmcd # Run pmcd group tests
# Create new test
cd qa && ./new
# Remake expected output for a test
cd qa && ./remake 123# Start the PCP daemon
sudo systemctl start pmcd
# or
sudo service pmcd start
# Check PCP metrics
pminfo -dfmt
pmprobe -v- libpcp: Main PCP library providing core functionality
- pmcd: Performance Metrics Collection Daemon - central coordinator
- pmlogger: Performance data logging daemon
- pmie: Performance Metrics Inference Engine - rule-based monitoring
- pmproxy: Web API proxy and time series interface
- Data Collection Tools: pmcd, pmlogger, various pmdas
- Data Export Tools: pcp2arrow, pcp2elasticsearch, pcp2json, etc.
- Analysis Tools: pminfo, pmval, pmstat, pmchart, pmrep and pcp subtools
- Archive Tools: pmlogdump, pmlogextract, pmlogrewrite, pmlogsummary
- Administrative Tools: pmconfig, pmlc, pmafm, pmcheck
PMDAs collect metrics from specific subsystems. Key directories in src/pmdas/:
- Platform PMDAs: linux, darwin, aix, windows - core system metrics
- Application PMDAs: apache, mysql, postgres, mongodb, elasticsearch
- System PMDAs: bpf, bpftrace, nvidia, amdgpu
- Network PMDAs: cisco, bind2, apache, nginx
- Storage PMDAs: dm, nfsclient, gluster, xfs
- Development PMDAs: sample, simple, trivial - for testing and examples
- libpcp: Core library with platform abstractions
- libpcp_pmda: PMDA development framework
- libpcp_pmcd: PMCD-specific functionality
- libpcp_gui: GUI toolkit integration
- libpcp_web: Web API and time series support
- libpcp_trace: Event trace instrumentation
- libpcp_import: Data import for PCP archives
pcp-code-reviewer- Reviews code against PCP project standards (whitespace, naming, structure, PCP patterns)
- All changes should include appropriate QA tests
- Tests should be deterministic and portable across platforms
- Use existing archives and filtering functions where possible
- Tests run as non-root user with sudo for privileged operations
- Use
src/pmdas/simpleorsrc/pmdas/sampleas starting templates - Follow the Install/Remove script patterns in existing PMDAs
- PMDAs can be written in C, Python, or Perl
- Follow existing code style in surrounding files
- Add permanent diagnostics using pmDebugOptions framework
- Use GPL-compatible licensing for all contributions
- Never introduce code that logs or exposes secrets
- PCP must be installed (not run from source tree)
- User "pcp" must exist for services
- User "pcpqa" used for testing via pcp-testsuite package
- Sudo access required for privileged operations
# First-time setup validation
cd qa && ./check 000
# Check specific functionality
cd qa && ./check -g pmcd # PMCD tests
cd qa && ./check -g pmda # PMDA tests
cd qa && ./check -g archive # Archive testsPCP supports Linux, macOS, Windows (MinGW), AIX, and Solaris. Tests should be written to be portable or use _notrun() for platform-specific limitations.
When developing on macOS (Platform: darwin in environment):
-
Stage changes before VM tests
- The Tart VM accesses the filesystem directly —
git addis the minimum required - Unstaged changes in
src/pmdas/darwin*ANDbuild/mac/are INVISIBLE to the VM - A full commit also works; either way, run
/macos-qa-testafter staging
- The Tart VM accesses the filesystem directly —
-
Test environments
- Unit tests: Run locally (no PCP needed)
- Integration tests: Tart VM only (
/macos-qa-test)
macos-darwin-pmda-qa- Runs integration tests in isolated Tart VM
./Makepkgs --verbose # One-time: full build (5-30 min)
cd build/mac/test && ./run-all-tests.sh # Daily: build + test (20-30s)| Directory | Purpose |
|---|---|
build/mac/ |
Test orchestration, PKG packaging, Tart VMs |
dev/darwin/ |
Quick-compile tools (~10s vs 30min) |
src/pmdas/darwin/ |
Darwin PMDA source code |
src/pmdas/darwin_proc/ |
Darwin process PMDA source |
build/mac/CLAUDE.md- Development workflow, test commandsbuild/mac/MACOS_DEVELOPMENT.md- Tart VM clean-room builds
Nix packaging is provided via flake.nix and the build/nix/ directory.
See docs/HowTos/nix/index.rst for full documentation.
nix build # Build PCP package
nix develop # Development shell
nix flake show # List all packages and apps