Ascend/msagent / skills/profiler/ascend-prof-compare
ascend-prof-compare
VerifiedCompares two Prof datasets (GPU vs NPU / NPU vs NPU) by auto-installing and calling msprof-analyze compare, then parses the result xlsx into HTML report and Chinese xlsx. Invoke when user provides two prof dirs to compare, or has a compare result xlsx to analyze/translate.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 11.2 KB |
| references/analysis_methodology.md | markdown | 15.1 KB |
| references/compare_quickstart.md | markdown | 3.6 KB |
| scripts/csv_translator.py | script | 8.2 KB |
| scripts/html_generator.py | script | 38.7 KB |
| scripts/main_analyzer.py | script | 11.8 KB |
| scripts/parsers/__init__.py | script | 35 B |
| scripts/parsers/api_compare.py | script | 3.1 KB |
| scripts/parsers/common.py | script | 1.6 KB |
| scripts/parsers/communication.py | script | 2.5 KB |
| scripts/parsers/kernel.py | script | 13.3 KB |
| scripts/parsers/memory.py | script | 3.6 KB |
| scripts/parsers/module.py | script | 4.1 KB |
| scripts/parsers/operator.py | script | 4.0 KB |
| scripts/parsers/overall_metrics.py | script | 5.9 KB |
| scripts/run_compare.py | script | 9.3 KB |
scripts/parsers/api_compare.py
View on GitHub"""ApiCompare API比对解析器(优化版)
分析思路:
1. 按总耗时差异排序
2. 区分纯耗时变化(calls_ratio=1.0)vs 调用次数变化
3. 统计整体劣化/改善趋势
"""
from parsers.common import safe_float, safe_int, get_sheet_data
def parse(wb) -> dict:
headers, rows = get_sheet_data(wb, 'ApiCompare')
if not rows:
return {'sheet_name': 'ApiCompare', 'available': False, 'reason': 'Sheet不存在或为空'}
apis = []
for row in rows:
if len(row) < 14:
continue
api_name = row[1].strip() if row[1] else ''
if not api_name or api_name == 'api name':
continue
apis.append({
'name': api_name,
'base_total': safe_float(row[2]),
'base_self': safe_float(row[3]),
'base_avg': safe_float(row[4]),
'base_calls': safe_int(row[5]),
'comp_total': safe_float(row[6]),
'comp_self': safe_float(row[7]),
'comp_avg': safe_float(row[8]),
'comp_calls': safe_int(row[9]),
'total_ratio': safe_float(row[10]),
'self_ratio': safe_float(row[11]),
'avg_ratio': safe_float(row[12]),
'calls_ratio': safe_float(row[13]),
})
for a in apis:
a['diff_total'] = a['comp_total'] - a['base_total']
apis.sort(key=lambda x: x['diff_total'], reverse=True)
top10 = apis[:10]
# 分析劣化原因
for a in top10:
calls_changed = a['calls_ratio'] > 1.05 if a['calls_ratio'] > 0 else False
self_changed = a['self_ratio'] > 1.05 if a['self_ratio'] > 0 else False
if calls_changed and self_changed:
a['degradation_type'] = 'Self耗时和调用次数均增加'
elif calls_changed:
a['degradation_type'] = '调用次数增加'
elif self_changed:
a['degradation_type'] = 'Self耗时增加'
elif a['diff_total'] > 0:
a['degradation_type'] = '轻微劣化'
else:
a['degradation_type'] = '轻微变化'
# 统计整体趋势
degraded = [a for a in apis if a['diff_total'] > 0]
improved = [a for a in apis if a['diff_total'] < 0]
total_degraded = sum(a['diff_total'] for a in degraded)
total_improved = sum(abs(a['diff_total']) for a in improved)
# 区分纯耗时变化 vs 调用次数变化
pure_duration_change = [a for a in degraded if a['calls_ratio'] == 1.0]
call_count_change = [a for a in degraded if a['calls_ratio'] != 1.0]
return {
'sheet_name': 'ApiCompare',
'available': True,
'total_apis': len(apis),
'degraded_count': len(degraded),
'improved_count': len(improved),
'total_degraded_ms': round(total_degraded, 2),
'total_improved_ms': round(total_improved, 2),
'net_trend': '劣化' if total_degraded > total_improved else '改善' if total_improved > total_degraded else '持平',
'pure_duration_change_count': len(pure_duration_change),
'call_count_change_count': len(call_count_change),
'top10': top10,
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |