profile

Solid

Run CPU and memory profiling with pprof to identify performance hotspots. Use when investigating high resource usage.

Data & Documents 21 stars 1 forks Updated 1 months ago MIT

Install

View on GitHub

Quality Score: 76/100

Stars 20%
45
Recency 20%
75
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# CPU and Memory Profiling Profile Go code to identify CPU hotspots and memory allocators using pprof. ## Usage - `/profile cpu ./internal/index/` - CPU profiling on index package - `/profile memory ./internal/repo/` - Memory profiling on repo package - `/profile all ./...` - Both CPU and memory on all packages ## Steps 1. **Parse arguments** - First argument: Profile type (`cpu`, `memory`, or `all`) - Second argument: Package path (defaults to `./...`) 2. **Create profile output directory** ```bash mkdir -p .profiles ``` 4. **Run profiling benchmarks** For CPU profiling: ```bash go test -cpuprofile=.profiles/cpu.prof -bench=. $PACKAGE 2>&1 ``` For memory profiling: ```bash go test -memprofile=.profiles/mem.prof -bench=. $PACKAGE 2>&1 ``` 5. **Analyze CPU profile** ```bash go tool pprof -top -cum .profiles/cpu.prof 2>&1 | head -30 ``` Identify: - Top 10 CPU consumers by cumulative time - Functions with high self time (computation hotspots) - Unexpected entries (potential optimization targets) 6. **Analyze memory profile** ```bash go tool pprof -top -alloc_space .profiles/mem.prof 2>&1 | head -30 ``` Identify: - Top allocators by total bytes - Functions with high allocation counts - Potential sources of GC pressure 7. **Generate flamegraph data** (if requested) ```bash go tool pprof -raw .profiles/cpu.prof > .profiles/cpu.raw ``` 8. **Report findings** Structure the rep...

Details

Author
PeterBooker
Repository
PeterBooker/veloria
Created
3 months ago
Last Updated
1 months ago
Language
Go
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

Testing & QA Featured

golang-benchmark

Golang benchmarking, profiling, and performance measurement. Use when writing, running, or comparing Go benchmarks, profiling hot paths with pprof, interpreting CPU/memory/trace profiles, analyzing results with benchstat, setting up CI benchmark regression detection, or investigating production performance with Prometheus runtime metrics. Also use when the developer needs deep analysis on a specific performance indicator - this skill provides the measurement methodology, while golang-performance provides the optimization patterns.

1,098 Updated 1 months ago
samber
AI & Automation Solid

perf

Performance regression gate. Detects N+1 queries, sync-in-async, missing indexes, memory leaks, and bundle bloat before they reach production.

75 Updated 1 weeks ago
Rune-kit
Code & Development Featured

dd-debugger

Live Debugger - inspect runtime argument/variable values in production by placing log probes on methods. Use when asked what values a function receives, what parameters look like at runtime, or to capture live data from running services without redeploying.

823 Updated 2 days ago
datadog-labs
DevOps & Infrastructure Solid

docker

Manage the workflow engine's Docker Compose stack. Use when starting, stopping, rebuilding containers, or resetting the database.

162 Updated 3 days ago
Altinn
Data & Documents Solid

research

Gather facts and context from codebase, docs, and web,... Use when exploring patterns, finding implementations, looking up documentation, or researching before decisions.

63 Updated 1 weeks ago
avibebuilder