Skip to content

Commit e1f4db3

Browse files
committed
docs updates and formatting
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
1 parent 0a312ac commit e1f4db3

File tree

9 files changed

+55
-52
lines changed

9 files changed

+55
-52
lines changed

.claude/CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# CLAUDE.md
22

3-
@../.github/copilot-instructions.md
3+
@../.github/copilot-instructions.md

.github/copilot-instructions.md

Lines changed: 28 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,28 @@
22

33
## Project Overview
44

5-
PerfSpect is a performance analysis tool for Linux systems written in Go. It provides several commands:
6-
- `metrics`: Collects CPU performance metrics using hardware performance counters
7-
- `report`: Generates system configuration and health reports from collected data
8-
- `benchmark`: Runs performance micro-benchmarks to evaluate system health
9-
- `telemetry`: Gathers system telemetry data
10-
- `flamegraph`: Creates CPU flamegraphs
11-
- `lock`: Analyzes lock contention
12-
- `config`: Modifies system configuration for performance tuning
5+
PerfSpect is a performance analysis tool for Linux systems written in Go. It provides commands for collecting CPU performance metrics, generating system configuration reports, running micro-benchmarks, gathering telemetry, creating flamegraphs, analyzing lock contention, and modifying system configuration. It can target both local and remote systems via SSH.
136

14-
The tool can target both local and remote systems via SSH.
7+
See `ARCHITECTURE.md` for detailed architecture, data flow diagrams, and concurrency model.
158

169
## Project Structure
1710

1811
- `main.go` - Application entry point
19-
- `cmd/` - Command implementations (metrics, report, telemetry, flamegraph, lock, config)
20-
- `internal/` - Internal packages (common, cpus, progress, report, script, table, target, util)
21-
- `internal/common/` - Shared types, functions, and workflows for commands
22-
- `internal/target/` - Abstraction for local and remote target systems
23-
- `internal/table/` - Table definitions and helpers for reports
24-
- `internal/script/` - Script execution framework and script dependencies as embedded resources
25-
- `internal/report/` - Report generation and formatting
26-
- `internal/progress/` - Progress tracking utilities
27-
- `internal/cpus/` - CPU architecture detection and metadata
28-
- `internal/util/` - General utility functions
29-
- `tools/` - External tools and utilities, i.e., dependencies used for collecting data on target systems
12+
- `cmd/` - Command implementations (metrics, report, benchmark, telemetry, flamegraph, lock, config)
13+
- Subcommands: `metrics trim`, `config restore`
14+
- `update` and `extract` commands are defined in `cmd/root.go`
15+
- `internal/`
16+
- `app/` - Application context and shared types
17+
- `workflow/` - Shared workflow orchestration for reporting commands
18+
- `extract/` - Data extraction functions from script outputs
19+
- `target/` - Target abstraction (local and remote via SSH)
20+
- `script/` - Script execution framework; scripts and tool dependencies are embedded via `//go:embed`
21+
- `report/` - Report generation and formatting (txt, json, html, xlsx)
22+
- `table/` - Table definitions and helpers for reports
23+
- `cpus/` - CPU architecture detection and metadata
24+
- `progress/` - Progress indicator (multi-spinner)
25+
- `util/` - General utility functions
26+
- `tools/` - Binaries used by scripts (embedded at build time)
3027
- `builder/` - Docker-based build system
3128
- `scripts/` - Helper scripts
3229

@@ -45,18 +42,11 @@ The tool can target both local and remote systems via SSH.
4542

4643
### Building and Testing
4744

48-
#### Build Commands
49-
5045
- `make` - Build the x86_64 binary
51-
52-
#### Testing
53-
46+
- `make perfspect-aarch64` - Build the ARM64 binary
5447
- `make test` - Run all unit tests
55-
- Follow standard Go testing practices
56-
57-
#### Code Quality Checks
58-
59-
Run `make check` to perform all code quality checks
48+
- `make check` - Run all code quality checks
49+
- Individual checks: `make check_format`, `make check_vet`, `make check_static`, `make check_lint`, `make check_vuln`, `make check_sec`, `make check_semgrep`
6050

6151
### Logging
6252

@@ -67,7 +57,6 @@ Run `make check` to perform all code quality checks
6757

6858
- Uses `github.com/spf13/cobra` for CLI
6959
- Each command is in its own subdirectory under `cmd/`
70-
- Some commands have subcommands (e.g., `metrics trim`, `config restore`)
7160
- Common flags are defined in `cmd/root.go`
7261

7362
### Target Systems
@@ -79,8 +68,13 @@ Run `make check` to perform all code quality checks
7968

8069
### Documentation
8170

82-
- Update README.md for user-facing changes
8371
- Use comments for complex logic
84-
- Document public APIs
8572
- Add examples for new features
86-
- Keep command help text up to date
73+
- Update cobra command help strings in source, then run `make docs` to regenerate `docs/perfspect_*.md` (requires a built binary)
74+
- Update README.md for user-facing changes
75+
- Update ARCHITECTURE.md for architectural changes
76+
77+
## Agent Instructions
78+
79+
- Ask clarifying questions if requirements are ambiguous
80+
- Unless it is a very simple task, start with an explanation and plan instead of jumping directly to coding a solution

ARCHITECTURE.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This document describes the high-level architecture of PerfSpect to help new con
66

77
PerfSpect is a performance analysis tool for Linux systems. It collects system configuration data, hardware performance metrics, and generates reports. The tool supports both local execution and remote targets via SSH.
88

9-
```
9+
```text
1010
┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
1111
│ CLI (cmd/root.go) │
1212
│ report │ benchmark │ telemetry │ flamegraph │ lock │ metrics │ config │ update │ extract │
@@ -52,7 +52,7 @@ PerfSpect is a performance analysis tool for Linux systems. It collects system c
5252

5353
## Directory Structure
5454

55-
```
55+
```text
5656
perfspect/
5757
├── main.go # Entry point
5858
├── cmd/ # Command implementations
@@ -99,6 +99,7 @@ type Target interface {
9999
```
100100

101101
**Implementations:**
102+
102103
- `LocalTarget`: Executes commands directly on the local machine
103104
- `RemoteTarget`: Executes commands via SSH on remote machines
104105

@@ -118,6 +119,7 @@ type ReportingCommand struct {
118119
```
119120

120121
**Workflow (`ReportingCommand.Run()`):**
122+
121123
1. Parse flags and validate inputs
122124
2. Initialize targets (local or from `--target`/`--targets` flags)
123125
3. For each target in parallel:
@@ -132,12 +134,14 @@ type ReportingCommand struct {
132134
Collection scripts are defined in `internal/script/scripts.go`. Script dependencies, i.e., tools used by the scripts to collect data, are in `internal/script/resources/` and embedded in the binary using `//go:embed`. The scripts are executed on targets via a controller script that manages concurrent/sequential execution and signal handling.
133135

134136
**Key concepts:**
137+
135138
- `ScriptDefinition`: Defines a script (template, dependencies, required privileges)
136139
- `ScriptOutput`: Captures stdout, stderr, and exit code
137140
- `controller.sh`: Generated script that orchestrates all scripts on a target
138141

139142
**Flow:**
140-
```
143+
144+
```text
141145
1. Scripts defined in code with templates and dependencies
142146
2. Controller script generated from concurrent + sequential scripts
143147
3. Scripts and dependencies copied to target temp directory
@@ -161,6 +165,7 @@ type TableDefinition struct {
161165
```
162166

163167
**Field value retrieval:**
168+
164169
- `ValuesFunc`: Function that parses script output and returns field values
165170
- Supports regex extraction, JSON parsing, and custom logic
166171

@@ -175,6 +180,7 @@ type Loader interface {
175180
```
176181

177182
**Implementations:**
183+
178184
- `LegacyLoader`: Original format (CLX, SKX, BDX, AMD processors)
179185
- `PerfmonLoader`: Intel perfmon JSON format (GNR, EMR, SPR, ICX)
180186
- `ComponentLoader`: ARM processors (Graviton, Axion, Ampere)
@@ -183,7 +189,7 @@ The `NewLoader()` factory function returns the appropriate loader based on CPU m
183189

184190
## Data Flow Example: `perfspect report`
185191

186-
```
192+
```text
187193
1. User runs: perfspect report --target 192.168.1.2 --user admin --key ~/.ssh/id_rsa
188194
189195
2. cmd/report/report.go:
@@ -224,7 +230,8 @@ PerfSpect uses goroutines for parallel operations:
224230
3. **Signal handling**: A goroutine listens for SIGINT/SIGTERM and coordinates graceful shutdown across all targets
225231

226232
**Signal handling flow:**
227-
```
233+
234+
```text
228235
SIGINT received
229236
→ Signal handler goroutine activated
230237
→ For each target: send SIGINT to controller.sh PID
@@ -243,4 +250,5 @@ make check # Run all code quality checks (format, vet, lint)
243250
Test files are colocated with source files (e.g., `extract_test.go` alongside `extract.go`).
244251

245252
## Functional Testing
246-
Functional tests are located in an Intel internal GitHub repository. The tests run against various Linux distributions and CPU architectures on internal servers and public cloud systems to validate end-to-end functionality.
253+
254+
Functional tests are located in an Intel internal GitHub repository. The tests run against various Linux distributions and CPU architectures on internal servers and public cloud systems to validate end-to-end functionality.

CODE_OF_CONDUCT.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,4 +128,5 @@ For answers to common questions about this code of conduct, see the FAQ at
128128
[homepage]: https://www.contributor-covenant.org
129129
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130130
[Mozilla CoC]: https://github.com/mozilla/diversity
131-
[FAQ]: https://www.contributor-covenant.org/faq
131+
[FAQ]: https://www.contributor-covenant.org/faq
132+
[translations]: https://www.contributor-covenant.org/translations

GEMINI.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Gemini Guidelines
22

3-
Unless it is a very simple task, start with an explanation and plan instead of jumping directly to coding a solution.
4-
53
When creating or replacing files, use your native `write_file` tool instead of the `cat << EOF` heredoc pattern in the shell.
64

75
Include the project-wide development guidelines from the Copilot instructions file.

SECURITY.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
Security Policy
22
===============
33

4-
## Report a Vulnerability
4+
Report a Vulnerability
5+
----------------------
56

67
Submit your vulnerabilities as bug reports to the GitHub issues page. Refer to GitHub's [Creating an issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/creating-an-issue) for instructions.
78

89
Provide the following information:
10+
911
* Title
1012
* Location of the vulnerability
1113
* Steps to reproduce
1214
* Expected result
1315
* Actual result
14-
* Proof
16+
* Proof

SUPPORT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Support
22
=======
33

4-
Submit your support needs to the GitHub issues page. Refer to GitHub's [Creating an issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/creating-an-issue) for instructions.
4+
Submit your support needs to the GitHub issues page. Refer to GitHub's [Creating an issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/creating-an-issue) for instructions.

docs/perfspect-daemonset.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
## Example DaemonSet for PerfSpect for GKE
1+
# Example DaemonSet for PerfSpect for GKE
22

33
This is an example DaemonSet for exposing PerfSpect metrics as a prometheus compatible metrics endpoint. This example assumes the use of Google Kubernetes Engine (GKE) and using the `PodMonitoring` resource to collect metrics from the metrics endpoint.
44

5-
```
5+
``` yaml
66
apiVersion: apps/v1
77
kind: DaemonSet
88
metadata:
@@ -61,4 +61,5 @@ spec:
6161
- port: metrics-port
6262
interval: 30s
6363
```
64-
* Replace `docker.registry/user-sandbox/ar-us/perfspect` with the location of your perfspect container image.
64+
65+
* Replace `docker.registry/user-sandbox/ar-us/perfspect` with the location of your perfspect container image.

docs/perfspect_flamegraph.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# perfspect flamegraph
22

3-
43
```text
54
Collect flamegraph data from target(s)
65
@@ -18,7 +17,7 @@ Flags:
1817
--frequency number of samples taken per second (default: 11)
1918
--pids comma separated list of PIDs. If not specified, all PIDs will be collected (default: [])
2019
--perf-event perf event to use for native sampling (e.g., cpu-cycles, instructions, cache-misses, branches, context-switches, mem-loads, mem-stores, etc.) (default: cycles:P)
21-
--dual-native-stacks also record DWARF unwind perf and merge with frame-pointer stacks per process (larger profiles) (default: false)
20+
--dual-native-stacks also record DWARF unwind perf and merge with frame-pointer stacks per process (larger profiles, longer post-processing time) (default: false)
2221
--asprof-args arguments to pass to async-profiler, e.g., $ asprof start <these arguments> -i <interval> <pid>. (default: -t -F probesp+vtable)
2322
--max-depth maximum render depth of call stack in flamegraph (0 = no limit) (default: 0)
2423
--format choose output format(s) from: all, html, txt, json (default: [html])

0 commit comments

Comments
 (0)