Ascend/msagent / skills/profiler/ascend-cluster-compare
ascend-cluster-compare
VerifiedAscend cluster comparison tool. Invoke when user asks to compare two cluster datasets (DB or TEXT), or to generate cluster_analysis_output from raw profiling data via msprof-analyze and then compare.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 26.1 KB |
| references/db_schema.md | markdown | 8.2 KB |
| references/text_schema.md | markdown | 9.0 KB |
| scripts/advanced_insights.py | script | 15.2 KB |
| scripts/cluster_data_extractor.py | script | 36.0 KB |
| scripts/generate_cluster_md.py | script | 28.0 KB |
| scripts/generate_cluster_report.py | script | 46.3 KB |
| scripts/run_advanced_analysis.py | script | 20.9 KB |
| scripts/verify_extracted_metrics.py | script | 7.2 KB |
| templates/cluster_compare_report.html | other | 15.3 KB |
templates/cluster_compare_report.html
View on GitHub<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>集群对比分析报告 - 异常集群劣化根因分析</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.jsdelivr.net/npm/echarts@5.5.0/dist/echarts.min.js"></script>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<style>
body { font-family: 'Inter', 'Microsoft YaHei', sans-serif; background-color: #0f172a; color: #f8fafc; }
.card { background-color: #1e293b; border: 1px solid #334155; border-radius: 0.75rem; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); }
.text-gradient { background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #0f172a; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }
table th { background: #334155; color: #cbd5e1; }
table td { border-bottom: 1px solid #334155; }
table tr:hover { background: #334155; }
.delta-up { color: #f87171; font-weight: 600; }
.delta-down { color: #34d399; font-weight: 600; }
.delta-neutral { color: #94a3b8; }
.heatmap-low { background: #064e3b; color: #6ee7b7; }
.heatmap-mid { background: #78350f; color: #fcd34d; }
.heatmap-high { background: #7f1d1d; color: #fca5a5; }
</style>
</head>
<body class="min-h-screen p-4 md:p-8">
<div class="max-w-7xl mx-auto space-y-6">
<!-- [1] Header -->
<header class="flex flex-col md:flex-row justify-between items-start md:items-center pb-6 border-b border-slate-700">
<div>
<h1 class="text-3xl md:text-4xl font-bold bg-gradient-to-r from-red-400 to-orange-400 text-gradient">集群劣化根因分析报告</h1>
<p class="text-slate-400 mt-2 text-sm md:text-base">对比分析:基准集群 (A) vs 对比集群 (B) 的性能瓶颈诊断</p>
</div>
<div class="mt-4 md:mt-0 flex items-center space-x-2 bg-red-900/30 text-red-400 px-4 py-2 rounded-full border border-red-800">
<span class="relative flex h-3 w-3">
<span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"></span>
<span class="relative inline-flex rounded-full h-3 w-3 bg-red-500"></span>
</span>
<span class="font-semibold text-sm">{{STATUS_TEXT}}</span>
</div>
</header>
<div class="text-xs text-slate-500 -mt-4 mb-2">A: {{PATH_A}} | B: {{PATH_B}} | 生成时间: {{GENERATE_TIME}}</div>
<!-- [2] KPI Cards -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
<div class="card p-5 relative overflow-hidden">
<div class="text-slate-400 text-sm font-medium mb-1">Stage 总耗时增幅</div>
<div class="text-3xl font-bold {{STAGE_DELTA_COLOR}}">{{STAGE_DELTA_SIGN}}{{STAGE_DELTA_PERCENT}}%</div>
<div class="text-xs text-slate-500 mt-2">{{STAGE_A_MS}} → {{STAGE_B_MS}} ms</div>
<div class="absolute -right-4 -bottom-4 opacity-10 text-6xl">⏱️</div>
</div>
<div class="card p-5 relative overflow-hidden">
<div class="text-slate-400 text-sm font-medium mb-1">通信变化贡献度</div>
<div class="text-3xl font-bold {{COMM_CONTRIB_COLOR}}">{{COMM_CONTRIB}}</div>
<div class="text-xs text-slate-500 mt-2">ΔComm = {{DELTA_COMM_SIGN}}{{DELTA_COMM_MS}} ms</div>
<div class="text-xs mt-1 leading-snug {{COMM_CONTRIB_COLOR}}">{{COMM_CONTRIB_NOTE}}</div>
<div class="absolute -right-4 -bottom-4 opacity-10 text-6xl">📡</div>
</div>
<div class="card p-5 relative overflow-hidden">
<div class="text-slate-400 text-sm font-medium mb-1">计算变化贡献度</div>
<div class="text-3xl font-bold {{COMPUTE_CONTRIB_COLOR}}">{{COMPUTE_CONTRIB}}</div>
<div class="text-xs text-slate-500 mt-2">ΔCompute = {{DELTA_COMPUTE_SIGN}}{{DELTA_COMPUTE_MS}} ms</div>
<div class="text-xs mt-1 leading-snug {{COMPUTE_CONTRIB_COLOR}}">{{COMPUTE_CONTRIB_NOTE}}</div>
<div class="absolute -right-4 -bottom-4 opacity-10 text-6xl">⚙️</div>
</div>
<div class="card p-5 relative overflow-hidden">
<div class="text-slate-400 text-sm font-medium mb-1">带宽变化(均值口径)</div>
<div class="text-3xl font-bold {{BW_DELTA_COLOR}}">{{BW_DELTA_SIGN}}{{BW_DELTA_PERCENT}}%</div>
<div class="text-xs text-slate-500 mt-2">{{BW_A}} → {{BW_B}} GB/s</div>
<div class="text-xs mt-1 {{BW_VERDICT_COLOR}} font-semibold leading-snug">{{BW_VERDICT_TEXT}}</div>
<div class="absolute -right-4 -bottom-4 opacity-10 text-6xl">📉</div>
</div>
</div>
<!-- [3] Cluster Info + Diagnosis -->
<div class="card p-6 flex flex-col md:flex-row gap-8 items-center bg-slate-800/50">
<div class="flex-1 flex flex-col md:flex-row w-full gap-4">
<div class="flex-1 bg-slate-800 p-4 rounded-lg border border-slate-700">
<h3 class="text-emerald-400 font-semibold mb-3 flex items-center"><span class="w-2 h-2 rounded-full bg-emerald-400 mr-2"></span>基准集群 A</h3>
<div class="grid grid-cols-2 gap-2 text-sm">
<span class="text-slate-400">Rank 数:</span> <span class="font-mono text-white">{{RANK_A}}</span>
<span class="text-slate-400">Step 数:</span> <span class="font-mono text-white">{{STEP_A}}</span>
</div>
</div>
<div class="flex-1 bg-slate-800 p-4 rounded-lg border border-slate-700">
<h3 class="text-red-400 font-semibold mb-3 flex items-center"><span class="w-2 h-2 rounded-full bg-red-400 mr-2"></span>对比集群 B</h3>
<div class="grid grid-cols-2 gap-2 text-sm">
<span class="text-slate-400">Rank 数:</span> <span class="font-mono text-white">{{RANK_B}}</span>
<span class="text-slate-400">Step 数:</span> <span class="font-mono text-white">{{STEP_B}}</span>
</div>
</div>
</div>
<div class="w-full md:w-1/3 text-sm text-slate-300 border-l-0 md:border-l border-slate-600 pl-0 md:pl-6">
<p class="font-semibold text-white mb-2">诊断摘要:</p>
{{DIAGNOSIS_TEXT}}
</div>
</div>
<!-- [4] Step 耗时对比 + 带宽对比 -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
<div class="card p-6">
<h3 class="text-lg font-semibold text-slate-200 mb-4">Step 核心耗时对比 (ms)</h3>
<div id="chart-step-compare" class="w-full h-80"></div>
</div>
<div class="card p-6">
<h3 class="text-lg font-semibold text-slate-200 mb-4">通信带宽对比 (GB/s)</h3>
<div id="chart-bw-compare" class="w-full h-80"></div>
<div id="bw-placeholder" style="display:none;text-align:center;padding:40px;color:#64748b;">无带宽数据</div>
<div class="mt-3 text-xs p-3 rounded-lg bg-slate-800/70 border border-slate-700">
<span class="{{BW_VERDICT_COLOR}} font-semibold">带宽判定:{{BW_VERDICT_TEXT}}</span>
<span class="text-slate-500 ml-1">(有效吞吐 {{BW_EFF_A}} → {{BW_EFF_B}} GB/s,{{BW_EFF_DELTA}}%)</span>
</div>
<div class="mt-2">{{BW_TYPE_VERDICTS_HTML}}</div>
</div>
</div>
<!-- [5] 负载分布双饼图 + 关键定位点 -->
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
<div class="card p-6 lg:col-span-2">
<h3 class="text-lg font-semibold text-slate-200 mb-4">负载类型转换:{{LOAD_TYPE_TEXT}}</h3>
<div id="chart-distribution" class="w-full h-72"></div>
</div>
<div class="card p-6 bg-gradient-to-br from-slate-800 to-slate-900 flex flex-col justify-center">
<h3 class="text-xl font-bold text-red-400 mb-4 border-b border-red-900/50 pb-2">关键定位点</h3>
<ul class="space-y-4 text-sm text-slate-300">
{{KEY_POINTS_HTML}}
</ul>
</div>
</div>
<!-- [6] 劣化归因瀑布图 + 通信算子差异 -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
<div class="card p-6">
<h3 class="text-lg font-semibold text-slate-200 mb-4">劣化归因分解 (ms)</h3>
<div id="chart-waterfall" class="w-full h-80"></div>
</div>
<div class="card p-6">
<h3 class="text-lg font-semibold text-slate-200 mb-4">通信算子耗时差异 Top10 (ms)</h3>
<div id="chart-comm-diff" class="w-full h-80"></div>
<div id="comm-diff-placeholder" style="display:none;text-align:center;padding:40px;color:#64748b;">无通信数据</div>
</div>
</div>
<!-- [7] Rank 差异表 -->
<div class="card p-6">
<h3 class="text-lg font-semibold text-slate-200 mb-4">Rank 级 Stage 时间差异</h3>
<div class="overflow-x-auto">
<table class="w-full text-sm">
<thead><tr><th class="text-left p-3">Rank</th><th class="text-right p-3">集群A Stage (ms)</th><th class="text-right p-3">集群B Stage (ms)</th><th class="text-right p-3">差值 (ms)</th><th class="text-right p-3">变化率</th><th class="text-center p-3">趋势</th></tr></thead>
<tbody>{{RANK_DIFF_ROWS}}</tbody>
</table>
</div>
</div>
<!-- [8] 劣化根因 + 行动建议 -->
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div class="card p-6 border-t-4 border-t-red-500">
<h3 class="text-lg font-bold text-white mb-4">劣化根因总结</h3>
<div class="space-y-3">{{DEGRADATION_ITEMS}}</div>
</div>
<div class="card p-6 border-t-4 border-t-emerald-500">
<h3 class="text-lg font-bold text-white mb-4">行动建议与排查方向</h3>
<ul class="space-y-4">{{ACTION_ITEMS}}</ul>
</div>
</div>
<!-- [9] 进阶分析(msprof-analyze -m 专项,未启用时显示引导卡) -->
<div class="pb-10">{{ADVANCED_ANALYSIS_HTML}}</div>
</div>
<script>
const colorA = '#34d399';
const colorB = '#f87171';
const colorText = '#94a3b8';
const colorGrid = '#334155';
// Step 对比
var chartStep = echarts.init(document.getElementById('chart-step-compare'));
chartStep.setOption({
tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' } },
legend: { data: ['集群A Stage','集群B Stage'], textStyle: { color: colorText }, bottom: 0 },
grid: { left: '3%', right: '4%', bottom: '10%', top: '5%', containLabel: true },
xAxis: { type: 'category', data: {{STEP_LABELS}}, axisLabel: { color: colorText }, axisLine: { lineStyle: { color: colorGrid } } },
yAxis: { type: 'value', name: 'ms', nameTextStyle: { color: colorText }, axisLabel: { color: colorText }, splitLine: { lineStyle: { color: colorGrid, type: 'dashed' } } },
series: [
{ name: '集群A Stage', type: 'bar', data: {{A_STAGE_BAR}}, itemStyle: { color: colorA, borderRadius: [4,4,0,0] } },
{ name: '集群B Stage', type: 'bar', data: {{B_STAGE_BAR}}, itemStyle: { color: colorB, borderRadius: [4,4,0,0] } }
]
});
// 带宽对比
var chartBw = echarts.init(document.getElementById('chart-bw-compare'));
var bwHasData = {{BW_HAS_DATA}};
if (bwHasData) {
chartBw.setOption({
tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' } },
legend: { data: ['集群A 带宽','集群B 带宽'], textStyle: { color: colorText }, bottom: 0 },
grid: { left: '3%', right: '4%', bottom: '10%', top: '5%', containLabel: true },
xAxis: { type: 'category', data: {{BW_LABELS}}, axisLabel: { color: colorText, fontWeight: 'bold' }, axisLine: { lineStyle: { color: colorGrid } } },
yAxis: { type: 'value', name: 'GB/s', nameTextStyle: { color: colorText }, axisLabel: { color: colorText }, splitLine: { lineStyle: { color: colorGrid, type: 'dashed' } } },
series: [
{ name: '集群A 带宽', type: 'bar', barWidth: '25%', data: {{A_BW_BAR}}, itemStyle: { color: '#60a5fa', borderRadius: [4,4,0,0] }, label: { show: true, position: 'top', color: '#fff', formatter: '{c}' } },
{ name: '集群B 带宽', type: 'bar', barWidth: '25%', data: {{B_BW_BAR}}, itemStyle: { color: '#f87171', borderRadius: [4,4,0,0] }, label: { show: true, position: 'top', color: '#fff', formatter: '{c}' } }
]
});
} else {
document.getElementById('bw-placeholder').style.display = 'block';
document.getElementById('chart-bw-compare').style.display = 'none';
}
// 负载分布双饼图
var chartDist = echarts.init(document.getElementById('chart-distribution'));
chartDist.setOption({
tooltip: { trigger: 'item', formatter: '{a} <br/>{b}: {c}%' },
legend: { bottom: 0, textStyle: { color: colorText }, data: ['计算时间','通信时间','空闲时间'] },
color: ['#8b5cf6', '#f59e0b', '#64748b'],
series: [
{ name: '基准集群A占比', type: 'pie', radius: ['40%','70%'], center: ['25%','45%'], itemStyle: { borderRadius: 5, borderColor: '#1e293b', borderWidth: 2 }, label: { show: true, formatter: '{b}\n{d}%', color: '#cbd5e1', fontSize: 11 }, data: [{value:{{A_PIE_COMPUTE_PCT}}, name:'计算时间'},{value:{{A_PIE_COMM_PCT}}, name:'通信时间'},{value:{{A_PIE_FREE_PCT}}, name:'空闲时间'}] },
{ name: '对比集群B占比', type: 'pie', radius: ['40%','70%'], center: ['75%','45%'], itemStyle: { borderRadius: 5, borderColor: '#1e293b', borderWidth: 2 }, label: { show: true, formatter: '{b}\n{d}%', color: '#cbd5e1', fontSize: 11 }, data: [{value:{{B_PIE_COMPUTE_PCT}}, name:'计算时间'},{value:{{B_PIE_COMM_PCT}}, name:'通信时间'},{value:{{B_PIE_FREE_PCT}}, name:'空闲时间'}] }
],
graphic: [
{ type: 'text', left: '22%', top: '42%', textAlign: 'center', style: { text: '基准A', fill: '#34d399', font: 'bold 14px Inter' } },
{ type: 'text', left: '72%', top: '42%', textAlign: 'center', style: { text: '对比B', fill: '#f87171', font: 'bold 14px Inter' } }
]
});
// 瀑布图
var chartWf = echarts.init(document.getElementById('chart-waterfall'));
var wfData = {{WATERFALL_DATA}};
chartWf.setOption({
tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' }, formatter: function(p){ var d = wfData[p[0].dataIndex]; return d.name + ': ' + (d.value > 0 ? '+' : '') + d.value.toFixed(1) + ' ms' + (d.contrib ? '<br/>贡献度: ' + d.contrib + '%' : ''); } },
grid: { left: '3%', right: '4%', bottom: '3%', top: '5%', containLabel: true },
xAxis: { type: 'category', data: wfData.map(function(d){return d.name;}), axisLabel: { color: colorText }, axisLine: { lineStyle: { color: colorGrid } } },
yAxis: { type: 'value', name: 'ms', nameTextStyle: { color: colorText }, axisLabel: { color: colorText }, splitLine: { lineStyle: { color: colorGrid, type: 'dashed' } } },
series: [{ type: 'bar', barWidth: '45%', data: wfData.map(function(d){ return { value: d.value, itemStyle: { color: d.value > 0 ? '#f87171' : '#34d399', borderRadius: [4,4,0,0] } }; }) }]
});
// 通信算子差异
var chartCommDiff = echarts.init(document.getElementById('chart-comm-diff'));
var commDiffHasData = {{COMM_DIFF_HAS_DATA}};
if (commDiffHasData) {
chartCommDiff.setOption({
tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' }, formatter: function(p){ return p[0].name + '<br/>差值: ' + (p[0].value > 0 ? '+' : '') + p[0].value.toFixed(1) + ' ms'; } },
grid: { left: '3%', right: '4%', bottom: '15%', containLabel: true },
xAxis: { type: 'category', data: {{COMM_DIFF_LABELS}}, axisLabel: { color: colorText, rotate: 35, interval: 0, fontSize: 11 }, axisLine: { lineStyle: { color: colorGrid } } },
yAxis: { type: 'value', name: '差值 (ms)', nameTextStyle: { color: colorText }, axisLabel: { color: colorText }, splitLine: { lineStyle: { color: colorGrid, type: 'dashed' } } },
series: [{ type: 'bar', data: {{COMM_DIFF_VALUES}}, itemStyle: { color: function(p){ return p.data > 0 ? '#f87171' : '#34d399'; }, borderRadius: [4,4,0,0] } }]
});
} else {
document.getElementById('comm-diff-placeholder').style.display = 'block';
document.getElementById('chart-comm-diff').style.display = 'none';
}
window.addEventListener('resize', function(){ chartStep.resize(); chartBw.resize(); chartDist.resize(); chartWf.resize(); chartCommDiff.resize(); });
</script>
</body>
</html>
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |