feat: add opencode agents and skills for development workflows
New agents: - architect: system design, module interactions, data flow - debugger: crash/memory/thread debugging with ASan, TSan, valgrind, gdb - security-auditor: TLS, input validation, buffer safety, crypto audit - refactorer: DRY, separation of concerns, API simplification - integrator: integration tests, CI/CD pipeline, end-to-end verification - code-explainer: architecture walkthrough, code explanation New skills: - debug-workflow: structured debugging workflow - refactor: code restructuring with test verification - security-audit: full security review with checklist - benchmark: performance benchmarking with multi-run medians - release: version bump, tests, tagging Improved existing: - c-reviewer: added security checklist - cmake-expert: added ASan/TSan/UBSan configs, ccache, cross-compilation - perf-analyst: added perf/valgrind/gprof commands - test-writer: added fuzzing harnesses, integration test patterns - pr-build: added sanitizer build variants - pr-review: added security review, performance impact assessment
This commit is contained in:
@@ -71,4 +71,53 @@ For each bottleneck found:
|
||||
5. **Suggested optimization** — concrete code change or approach
|
||||
6. **Expected impact** — estimated speedup or resource savings
|
||||
|
||||
Also provide profiling guidance when asked (e.g., `perf`, `valgrind`, `gprof` commands).
|
||||
## Profiling Commands
|
||||
|
||||
### perf (Linux, recommended)
|
||||
```bash
|
||||
# Record call graph
|
||||
perf record -g ./build/client [args...]
|
||||
perf report
|
||||
|
||||
# Hardware counters (cache misses, branch mispredictions, etc.)
|
||||
perf stat ./build/client [args...]
|
||||
|
||||
# Specific events
|
||||
perf stat -e cache-misses,cache-references,instructions,cycles ./build/client [args...]
|
||||
|
||||
# Flame graph
|
||||
perf record -g -F 99 ./build/client [args...]
|
||||
perf script | stackcollapse-perf.pl | flamegraph.pl > flame.svg
|
||||
```
|
||||
|
||||
### valgrind (memory profiling)
|
||||
```bash
|
||||
# Callgrind (CPU profiling)
|
||||
valgrind --tool=callgrind ./build/client [args...]
|
||||
callgrind_annotate callgrind.out.*
|
||||
|
||||
# Cachegrind (cache simulation)
|
||||
valgrind --tool=cachegrind ./build/client [args...]
|
||||
cg_annotate cachegrind.out.*
|
||||
|
||||
# Massif (heap profiling)
|
||||
valgrind --tool=massif ./build/client [args...]
|
||||
ms_print massif.out.*
|
||||
```
|
||||
|
||||
### gprof
|
||||
```bash
|
||||
cmake -B build -S . -DCMAKE_C_FLAGS="-pg" -DCMAKE_EXE_LINKER_FLAGS="-pg"
|
||||
cmake --build build -j$(nproc)
|
||||
./build/client [args...]
|
||||
gprof ./build/client gmon.out > analysis.txt
|
||||
```
|
||||
|
||||
### Time Measurement
|
||||
```bash
|
||||
# Quick timing
|
||||
time ./build/client [args...]
|
||||
|
||||
# High precision
|
||||
perf stat -e task-clock ./build/client [args...]
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user