Token导航 LogoToken导航TokenDH.com
研究检索执行命令github未标认证来源可访问许可证需确认审计通过

performance-profiling性能分析

Agent Skill

performance-profiling 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

618

周安装

25

GitHub Stars

31

下载量

194
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:performance-profiling(性能分析)
来源仓库:https://github.com/heshamfs/materials-simulation-skills
仓库路径:skills/performance-profiling
安装命令:
npx skills add https://github.com/heshamfs/materials-simulation-skills --skill performance-profiling
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/heshamfs/materials-simulation-skills --skill performance-profiling

简介

用于查找、检索和筛选相关信息。

  • 适合在 Codex、Claude、Cursor、Gemini CLI 中根据关键词快速定位候选结果。
  • 通过 npx skills add 命令从指定 GitHub 仓库安装使用。
  • 安装前需确认权限范围、维护状态,避免触发联网或文件读写操作。
  • performance-profiling 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Performance Profiling

Goal

Provide tools to analyze simulation performance, identify bottlenecks, and recommend optimization strategies for computational materials science simulations.

Requirements

  • Python 3.8+
  • No external dependencies (uses Python standard library only)
  • Works on Linux, macOS, and Windows

Inputs to Gather

Before running profiling scripts, collect from the user:

InputDescriptionExample
Simulation logLog file with timing informationsimulation.log
Scaling dataJSON with multi-run performance datascaling_data.json
Simulation parametersJSON with mesh, fields, solver configparams.json
Available memorySystem memory in GB (optional)16.0

Decision Guidance

When to Use Each Script

Need to identify slow phases?
├── YES → Use timing_analyzer.py
│         └── Parse simulation logs for timing data
│
Need to understand parallel performance?
├── YES → Use scaling_analyzer.py
│         └── Analyze strong or weak scaling efficiency
│
Need to estimate memory requirements?
├── YES → Use memory_profiler.py
│         └── Estimate memory from problem parameters
│
Need optimization recommendations?
└── YES → Use bottleneck_detector.py
          └── Combine analyses and get actionable advice

Choosing Analysis Thresholds

MetricGoodAcceptablePoor
Phase dominance<30%30-50%>50%
Parallel efficiency>0.800.70-0.80<0.70
Memory usage<60%60-80%>80%

Script Outputs (JSON Fields)

ScriptKey Outputs
timing_analyzer.pytiming_data.phases, timing_data.slowest_phase, timing_data.total_time
scaling_analyzer.pyscaling_analysis.results, scaling_analysis.efficiency_threshold_processors
memory_profiler.pymemory_profile.total_memory_gb, memory_profile.per_process_gb, memory_profile.warnings
bottleneck_detector.pybottlenecks, recommendations

Workflow

Complete Profiling Workflow

  1. Analyze timing from simulation logs
  2. Analyze scaling from multi-run data (if available)
  3. Profile memory from simulation parameters
  4. Detect bottlenecks and get recommendations
  5. Implement optimizations based on recommendations
  6. Re-profile to verify improvements

Quick Profiling (Timing Only)

  1. Run timing analyzer on simulation log
  2. Identify dominant phases (>50% of runtime)
  3. Apply targeted optimizations to dominant phases

CLI Examples

Timing Analysis

# Basic timing analysis
python3 scripts/timing_analyzer.py \
    --log simulation.log \
    --json

# Custom timing pattern
python3 scripts/timing_analyzer.py \
    --log simulation.log \
    --pattern 'Step\s+(\w+)\s+took\s+([\d.]+)s' \
    --json

Scaling Analysis

# Strong scaling (fixed problem size)
python3 scripts/scaling_analyzer.py \
    --data scaling_data.json \
    --type strong \
    --json

# Weak scaling (constant work per processor)
python3 scripts/scaling_analyzer.py \
    --data scaling_data.json \
    --type weak \
    --json

Memory Profiling

# Estimate memory requirements
python3 scripts/memory_profiler.py \
    --params simulation_params.json \
    --available-gb 16.0 \
    --json

Bottleneck Detection

# Detect bottlenecks from timing only
python3 scripts/bottleneck_detector.py \
    --timing timing_results.json \
    --json

# Comprehensive analysis with all inputs
python3 scripts/bottleneck_detector.py \
    --timing timing_results.json \
    --scaling scaling_results.json \
    --memory memory_results.json \
    --json

Conversational Workflow Example

User: My simulation is taking too long. Can you help me identify what's slow?

Agent workflow:

  1. Ask for simulation log file
  2. Run timing analyzer: python3 scripts/timing_analyzer.py --log simulation.log --json
  3. Interpret results:

- If solver dominates (>50%): Recommend preconditioner tuning - If assembly dominates: Recommend caching or vectorization - If I/O dominates: Recommend reducing output frequency

  1. If user has multi-run data, analyze scaling: python3 scripts/scaling_analyzer.py --data scaling.json --type strong --json
  2. Generate comprehensive recommendations: python3 scripts/bottleneck_detector.py --timing timing.json --scaling scaling.json --json

Interpretation Guidance

Timing Analysis

ScenarioMeaningAction
Solver >70%Solver-dominatedTune preconditioner, check tolerance
Assembly >50%Assembly-dominatedCache matrices, vectorize, parallelize
I/O >30%I/O-dominatedReduce frequency, use parallel I/O
Balanced (<30% each)Well-balancedLook for algorithmic improvements

Scaling Analysis

EfficiencyMeaningAction
>0.80Excellent scalingContinue scaling up
0.70-0.80Good scalingMonitor at larger scales
0.50-0.70Poor scalingInvestigate communication/load balance
<0.50Very poor scalingReduce processor count or redesign

Memory Profile

UsageMeaningAction
<60% availableSafeNo action needed
60-80% availableModerateMonitor, consider optimization
>80% availableHighReduce resolution or increase processors
>100% availableExceeds capacityMust reduce problem size

Error Handling

ErrorCauseResolution
Log file not foundInvalid pathVerify log file path
No timing data foundPattern mismatchProvide custom pattern with --pattern
At least 2 runs requiredInsufficient dataProvide more scaling runs
Missing required parametersIncomplete paramsAdd mesh and fields to params file

Optimization Strategies by Bottleneck Type

Solver Bottlenecks

  • Use algebraic multigrid (AMG) preconditioner
  • Tighten solver tolerance if over-solving
  • Consider direct solver for small problems
  • Profile matrix assembly vs solve time

Assembly Bottlenecks

  • Cache element matrices if geometry is static
  • Use vectorized assembly routines
  • Consider matrix-free methods
  • Parallelize assembly with coloring

I/O Bottlenecks

  • Reduce output frequency
  • Use parallel I/O (HDF5, MPI-IO)
  • Write to fast scratch storage
  • Compress output data

Scaling Bottlenecks

  • Investigate communication overhead
  • Check for load imbalance
  • Reduce synchronization points
  • Use asynchronous communication
  • Consider hybrid MPI+OpenMP

Memory Bottlenecks

  • Reduce mesh resolution
  • Use iterative solver (lower memory than direct)
  • Enable out-of-core computation
  • Increase number of processors
  • Use single precision where appropriate

Security

Input Validation

  • User-supplied --pattern regex values are validated for length (500 chars max) and rejected if they contain constructs prone to catastrophic backtracking (ReDoS)
  • Scaling data entries are validated for finite time values, integer processor counts, and bounded run count (10,000 max)
  • available_gb is validated as a positive finite number; mesh dimensions and field parameters are validated as positive integers
  • --type (scaling type) is validated against a fixed allowlist (strong, weak)
  • All loaded JSON files must have an object (dict) as root element

File Access

  • timing_analyzer.py reads a single log file specified by --log; log files are capped at 500 MB and rejected before parsing
  • scaling_analyzer.py, memory_profiler.py, and bottleneck_detector.py read JSON files capped at 100 MB
  • Phase names extracted from log files are truncated to 200 characters and stripped of control characters to prevent prompt-injection payloads from propagating into agent context
  • No scripts write to the filesystem; all output goes to stdout

Tool Restrictions

  • Read: Used to inspect script source, references, simulation logs, and result files
  • Write: Used to save profiling reports or optimization recommendations; writes are scoped to the user's working directory
  • Grep/Glob: Used to locate log files, result files, and search references
  • The skill's allowed-tools excludes Bash to prevent the agent from executing arbitrary commands when processing untrusted simulation logs or result files

Safety Measures

  • No eval(), exec(), or dynamic code generation
  • All subprocess calls use explicit argument lists (no shell=True)
  • Reduced tool surface (no Bash) limits the agent to read/write operations only
  • Phase names and diagnostic strings are sanitized before inclusion in output to prevent injection

Limitations

  • Log parsing: Depends on pattern matching; may miss unusual formats
  • Scaling analysis: Requires at least 2 runs for meaningful results
  • Memory estimation: Approximate; actual usage may vary
  • Recommendations: General guidance; may need domain-specific tuning

References

  • references/profiling_guide.md - Profiling concepts and interpretation
  • references/optimization_strategies.md - Detailed optimization approaches

Version History

  • v1.0.0 (2025-01-22): Initial release with 4 profiling scripts

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

37.92%
按下载量换算74

Claude

26.91%
按下载量换算52

Cursor

19.64%
按下载量换算38

Gemini CLI

8.39%
按下载量换算16

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/heshamfs/materials-simulation-skills --skill performance-profiling 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills