161-java-profiling-detect
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseJava Profiling Workflow / Step 1 / Collect data to measure potential issues
Java性能分析工作流 / 步骤1 / 收集数据以排查潜在问题
Set up the Java profiling detection phase: automated environment setup with async-profiler v4.0, problem-driven interactive profiling scripts, and comprehensive data collection for CPU hotspots, memory leaks, lock contention, GC issues, and I/O bottlenecks. Uses JEP 518 (Cooperative Sampling) and JEP 520 (Method Timing) for reduced overhead.
What is covered in this Skill?
- Run application with profiling JVM flags (run-java-process-for-profiling.sh)
- Interactive profiling script (profiler/scripts/profile-java-process.sh) — copy exact template
- Directory structure: profiler/scripts/, profiler/results/, profiler/current/
- Automated OS/architecture detection and async-profiler download
- CPU, memory, lock, GC, I/O profiling modes
- Flamegraph and JFR output with timestamped results
Scope: Use the exact bash script templates without modification or interpretation.
设置Java性能分析检测阶段:使用async-profiler v4.0自动配置环境、问题驱动的交互式分析脚本,以及针对CPU热点、内存泄漏、锁竞争、GC问题和I/O瓶颈的全面数据收集。通过JEP 518(协作采样)和JEP 520(方法计时)降低性能开销。
本技能包含哪些内容?
- 使用性能分析JVM参数运行应用(run-java-process-for-profiling.sh)
- 交互式性能分析脚本(profiler/scripts/profile-java-process.sh)—— 直接复制模板即可
- 目录结构:profiler/scripts/、profiler/results/、profiler/current/
- 自动检测操作系统/架构并下载async-profiler
- CPU、内存、锁、GC、I/O性能分析模式
- 生成带时间戳的火焰图和JFR输出结果
适用范围: 直接使用bash脚本模板,请勿修改或自行解读。
Constraints
约束条件
Copy bash scripts exactly from templates. Ensure JVM flags are applied for profiling compatibility. Verify Java processes are running before attaching profiler.
- CRITICAL: Copy the bash script templates exactly — do not modify, interpret, or enhance
- SETUP: Create profiler directory structure: profiler/scripts, profiler/results
- EXECUTABLE: Make scripts executable with chmod +x
- BEFORE APPLYING: Read the reference for exact script templates and setup instructions
直接从模板复制bash脚本。确保应用了兼容性能分析的JVM参数。在连接性能分析工具前,请确认Java进程正在运行。
- 重要提示:直接复制bash脚本模板——请勿修改、解读或优化
- 设置要求:创建profiler目录结构:profiler/scripts、profiler/results
- 可执行性:使用chmod +x命令赋予脚本可执行权限
- 使用前:查阅参考文档获取完整的脚本模板和设置说明
When to use this skill
何时使用本技能
- Improve the code with profiling
- Apply Profiling
- Refactor the code with profiling
- Add profiling support
- 通过性能分析优化代码
- 应用性能分析
- 结合性能分析重构代码
- 添加性能分析支持
Reference
参考资料
For detailed guidance, examples, and constraints, see references/161-java-profiling-detect.md.
如需详细指南、示例和约束条件,请查看references/161-java-profiling-detect.md。