@gracker/smartperfetto 1.0.19 → 1.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/core/conclusionContract.d.ts +1 -0
- package/dist/agent/core/conclusionContract.d.ts.map +1 -1
- package/dist/agent/tools/frameAnalyzer.d.ts.map +1 -1
- package/dist/agent/tools/frameAnalyzer.js +1 -0
- package/dist/agent/tools/frameAnalyzer.js.map +1 -1
- package/dist/agentOpenAI/openAiRuntime.d.ts +24 -0
- package/dist/agentOpenAI/openAiRuntime.d.ts.map +1 -1
- package/dist/agentOpenAI/openAiRuntime.js +159 -191
- package/dist/agentOpenAI/openAiRuntime.js.map +1 -1
- package/dist/agentRuntime/index.d.ts +1 -0
- package/dist/agentRuntime/index.d.ts.map +1 -1
- package/dist/agentRuntime/index.js +16 -1
- package/dist/agentRuntime/index.js.map +1 -1
- package/dist/agentRuntime/runtimeCommon.d.ts +34 -0
- package/dist/agentRuntime/runtimeCommon.d.ts.map +1 -0
- package/dist/agentRuntime/runtimeCommon.js +231 -0
- package/dist/agentRuntime/runtimeCommon.js.map +1 -0
- package/dist/agentv3/claudeConfig.d.ts +6 -2
- package/dist/agentv3/claudeConfig.d.ts.map +1 -1
- package/dist/agentv3/claudeConfig.js +50 -48
- package/dist/agentv3/claudeConfig.js.map +1 -1
- package/dist/agentv3/claudeMcpServer.d.ts.map +1 -1
- package/dist/agentv3/claudeMcpServer.js +74 -66
- package/dist/agentv3/claudeMcpServer.js.map +1 -1
- package/dist/agentv3/claudeRuntime.d.ts +18 -2
- package/dist/agentv3/claudeRuntime.d.ts.map +1 -1
- package/dist/agentv3/claudeRuntime.js +198 -265
- package/dist/agentv3/claudeRuntime.js.map +1 -1
- package/dist/agentv3/claudeSseBridge.js +1 -1
- package/dist/agentv3/claudeSseBridge.js.map +1 -1
- package/dist/agentv3/claudeVerifier.d.ts.map +1 -1
- package/dist/agentv3/claudeVerifier.js +3 -6
- package/dist/agentv3/claudeVerifier.js.map +1 -1
- package/dist/cli-user/bin.js +83 -2
- package/dist/cli-user/bin.js.map +1 -1
- package/dist/cli-user/commands/analyze.d.ts +2 -0
- package/dist/cli-user/commands/analyze.d.ts.map +1 -1
- package/dist/cli-user/commands/analyze.js +1 -0
- package/dist/cli-user/commands/analyze.js.map +1 -1
- package/dist/cli-user/commands/capture.d.ts +37 -2
- package/dist/cli-user/commands/capture.d.ts.map +1 -1
- package/dist/cli-user/commands/capture.js +184 -95
- package/dist/cli-user/commands/capture.js.map +1 -1
- package/dist/cli-user/commands/compare.d.ts +2 -0
- package/dist/cli-user/commands/compare.d.ts.map +1 -1
- package/dist/cli-user/commands/compare.js +1 -0
- package/dist/cli-user/commands/compare.js.map +1 -1
- package/dist/cli-user/commands/doctor.js +4 -0
- package/dist/cli-user/commands/doctor.js.map +1 -1
- package/dist/cli-user/services/androidCapture.d.ts +59 -0
- package/dist/cli-user/services/androidCapture.d.ts.map +1 -0
- package/dist/cli-user/services/androidCapture.js +375 -0
- package/dist/cli-user/services/androidCapture.js.map +1 -0
- package/dist/cli-user/services/captureConfig.d.ts +38 -0
- package/dist/cli-user/services/captureConfig.d.ts.map +1 -0
- package/dist/cli-user/services/captureConfig.js +434 -0
- package/dist/cli-user/services/captureConfig.js.map +1 -0
- package/dist/cli-user/services/captureTools.d.ts +11 -0
- package/dist/cli-user/services/captureTools.d.ts.map +1 -0
- package/dist/cli-user/services/captureTools.js +247 -0
- package/dist/cli-user/services/captureTools.js.map +1 -0
- package/dist/cli-user/services/cliAnalyzeService.d.ts +2 -0
- package/dist/cli-user/services/cliAnalyzeService.d.ts.map +1 -1
- package/dist/cli-user/services/cliAnalyzeService.js +1 -0
- package/dist/cli-user/services/cliAnalyzeService.js.map +1 -1
- package/dist/cli-user/services/runtimeGuard.d.ts +10 -0
- package/dist/cli-user/services/runtimeGuard.d.ts.map +1 -1
- package/dist/cli-user/services/runtimeGuard.js +48 -0
- package/dist/cli-user/services/runtimeGuard.js.map +1 -1
- package/dist/cli-user/services/turnRunner.d.ts +3 -0
- package/dist/cli-user/services/turnRunner.d.ts.map +1 -1
- package/dist/cli-user/services/turnRunner.js +4 -0
- package/dist/cli-user/services/turnRunner.js.map +1 -1
- package/dist/cli-user/types.d.ts +57 -0
- package/dist/cli-user/types.d.ts.map +1 -1
- package/dist/perfetto-recording-tools-pin.env +24 -0
- package/dist/services/agentResultNormalizer.d.ts.map +1 -1
- package/dist/services/agentResultNormalizer.js +32 -4
- package/dist/services/agentResultNormalizer.js.map +1 -1
- package/dist/services/evidence/evidenceContractBuilder.d.ts.map +1 -1
- package/dist/services/evidence/evidenceContractBuilder.js +17 -3
- package/dist/services/evidence/evidenceContractBuilder.js.map +1 -1
- package/dist/services/perfettoSqlSkill.d.ts.map +1 -1
- package/dist/services/perfettoSqlSkill.js +1 -0
- package/dist/services/perfettoSqlSkill.js.map +1 -1
- package/dist/services/providerManager/connectionTester.d.ts.map +1 -1
- package/dist/services/providerManager/connectionTester.js +4 -68
- package/dist/services/providerManager/connectionTester.js.map +1 -1
- package/dist/services/providerManager/index.d.ts +1 -0
- package/dist/services/providerManager/index.d.ts.map +1 -1
- package/dist/services/providerManager/index.js +8 -1
- package/dist/services/providerManager/index.js.map +1 -1
- package/dist/services/providerManager/providerService.d.ts.map +1 -1
- package/dist/services/providerManager/providerService.js +37 -106
- package/dist/services/providerManager/providerService.js.map +1 -1
- package/dist/services/providerManager/providerSnapshot.d.ts.map +1 -1
- package/dist/services/providerManager/providerSnapshot.js +13 -12
- package/dist/services/providerManager/providerSnapshot.js.map +1 -1
- package/dist/services/providerManager/runtimeCapabilities.d.ts +9 -0
- package/dist/services/providerManager/runtimeCapabilities.d.ts.map +1 -0
- package/dist/services/providerManager/runtimeCapabilities.js +105 -0
- package/dist/services/providerManager/runtimeCapabilities.js.map +1 -0
- package/dist/services/skillEngine/skillExecutor.d.ts +1 -0
- package/dist/services/skillEngine/skillExecutor.d.ts.map +1 -1
- package/dist/services/skillEngine/skillExecutor.js +64 -12
- package/dist/services/skillEngine/skillExecutor.js.map +1 -1
- package/package.json +3 -3
- package/prebuilts/android-platform-tools/README.md +13 -0
- package/prebuilts/perfetto-recording-tools/README.md +17 -0
- package/skills/atomic/cpu_topology_detection.skill.yaml +105 -159
- package/skills/atomic/cpu_topology_view.skill.yaml +2 -0
- package/strategies/prompt-openai-final-report-continuation-en.template.md +3 -1
- package/strategies/prompt-openai-final-report-continuation-zh.template.md +3 -1
- package/strategies/prompt-output-format.template.md +1 -1
- package/strategies/startup.strategy.md +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gracker/smartperfetto",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.20",
|
|
4
4
|
"description": "SmartPerfetto CLI and backend runtime",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"prepack": "npm run build",
|
|
56
56
|
"typecheck": "tsc --noEmit",
|
|
57
57
|
"test": "jest",
|
|
58
|
-
"test:core": "jest --runInBand --forceExit src/agent/communication/__tests__/agentMessageBus.test.ts src/agent/core/executors/__tests__/strategyExecutor.test.ts src/agent/core/executors/__tests__/hypothesisExecutor.test.ts src/agent/core/__tests__/modelRouter.test.ts src/agent/context/__tests__/enhancedSessionContext.test.ts src/tests/adbTools.test.ts src/services/__tests__/sessionLogger.test.ts src/agent/__tests__/llmAdapter.test.ts src/agent/agents/domain/__tests__/registry.test.ts src/agentv3/__tests__/sqlIncludeInjector.test.ts src/agentv3/__tests__/analysisPatternMemory.test.ts src/agentv3/__tests__/claudeRuntimeRuntimeSnapshots.test.ts src/agentv3/__tests__/claudeSseBridge.test.ts src/agentOpenAI/__tests__/openAiRuntime.test.ts src/agentRuntime/__tests__/runtimeSelection.test.ts src/middleware/__tests__/auth.test.ts src/assistant/application/__tests__/assistantApplicationService.test.ts src/assistant/application/__tests__/agentAnalyzeSessionService.test.ts src/services/__tests__/finalResultQualityGate.test.ts src/services/__tests__/persistAgentSession.test.ts src/services/__tests__/htmlReportGenerator.test.ts src/services/__tests__/analysisResultSnapshotPipeline.test.ts src/services/__tests__/rbac.test.ts src/routes/__tests__/agentRoutesRbac.test.ts src/routes/__tests__/ownerGuardRoutes.test.ts src/routes/__tests__/memoryRoutes.test.ts src/cli-user/services/__tests__/cliAnalyzeService.test.ts src/cli-user/services/__tests__/cliAnalyzeService.runTurn.test.ts src/middleware/__tests__/legacyApiCompatibility.test.ts src/services/__tests__/enterpriseDb.test.ts src/services/__tests__/enterpriseSchema.test.ts src/services/__tests__/enterpriseRepository.test.ts src/services/__tests__/processRss.test.ts src/services/__tests__/workingTraceProcessor.enterpriseIsolation.test.ts src/services/__tests__/traceProcessorLeaseStore.test.ts src/services/__tests__/traceProcessorLeaseModeDecision.test.ts src/services/__tests__/traceProcessorLeaseProcessorRouting.test.ts src/services/__tests__/traceProcessorSqlWorker.test.ts src/services/__tests__/traceProcessorRamBudget.test.ts src/scripts/__tests__/benchmarkTraceProcessorRss.test.ts src/scripts/__tests__/auditTraceProcessorRssMatrix.test.ts src/scripts/__tests__/enterpriseReadinessAudit.test.ts src/scripts/__tests__/enterpriseAcceptanceLoadTest.test.ts src/scripts/__tests__/enterpriseRuntimeIsolationChecklist.test.ts src/scripts/__tests__/enterpriseSecurityAuditChecklist.test.ts src/services/__tests__/analysisRunStore.test.ts src/services/__tests__/agentEventStore.test.ts src/services/__tests__/enterpriseKnowledgeScope.test.ts src/services/__tests__/enterpriseMigration.test.ts src/services/__tests__/runtimeSnapshotStore.test.ts src/services/providerManager/__tests__/localSecretStore.test.ts src/services/providerManager/__tests__/enterpriseProviderStore.test.ts src/services/providerManager/__tests__/providerSnapshot.test.ts src/routes/__tests__/enterpriseTraceMetadataRoutes.test.ts src/routes/__tests__/enterpriseTenantRoutes.test.ts src/routes/__tests__/traceProcessorProxyRoutes.test.ts src/routes/__tests__/enterpriseReportRoutes.test.ts src/routes/__tests__/enterpriseRuntimeDashboardRoutes.test.ts src/routes/__tests__/enterpriseRestartPersistence.test.ts",
|
|
58
|
+
"test:core": "jest --runInBand --forceExit src/agent/communication/__tests__/agentMessageBus.test.ts src/agent/core/executors/__tests__/strategyExecutor.test.ts src/agent/core/executors/__tests__/hypothesisExecutor.test.ts src/agent/core/__tests__/modelRouter.test.ts src/agent/context/__tests__/enhancedSessionContext.test.ts src/tests/adbTools.test.ts src/services/__tests__/sessionLogger.test.ts src/agent/__tests__/llmAdapter.test.ts src/agent/agents/domain/__tests__/registry.test.ts src/agentv3/__tests__/sqlIncludeInjector.test.ts src/agentv3/__tests__/analysisPatternMemory.test.ts src/agentv3/__tests__/claudeRuntimeRuntimeSnapshots.test.ts src/agentv3/__tests__/claudeSseBridge.test.ts src/agentOpenAI/__tests__/openAiRuntime.test.ts src/agentRuntime/__tests__/runtimeSelection.test.ts src/middleware/__tests__/auth.test.ts src/assistant/application/__tests__/assistantApplicationService.test.ts src/assistant/application/__tests__/agentAnalyzeSessionService.test.ts src/services/__tests__/finalResultQualityGate.test.ts src/services/__tests__/persistAgentSession.test.ts src/services/__tests__/htmlReportGenerator.test.ts src/services/__tests__/analysisResultSnapshotPipeline.test.ts src/services/__tests__/rbac.test.ts src/routes/__tests__/agentRoutesRbac.test.ts src/routes/__tests__/ownerGuardRoutes.test.ts src/routes/__tests__/memoryRoutes.test.ts src/cli-user/services/__tests__/cliAnalyzeService.test.ts src/cli-user/services/__tests__/cliAnalyzeService.runTurn.test.ts src/cli-user/services/__tests__/captureConfig.test.ts src/cli-user/services/__tests__/captureTools.test.ts src/cli-user/services/__tests__/androidCapture.test.ts src/middleware/__tests__/legacyApiCompatibility.test.ts src/services/__tests__/enterpriseDb.test.ts src/services/__tests__/enterpriseSchema.test.ts src/services/__tests__/enterpriseRepository.test.ts src/services/__tests__/processRss.test.ts src/services/__tests__/workingTraceProcessor.enterpriseIsolation.test.ts src/services/__tests__/traceProcessorLeaseStore.test.ts src/services/__tests__/traceProcessorLeaseModeDecision.test.ts src/services/__tests__/traceProcessorLeaseProcessorRouting.test.ts src/services/__tests__/traceProcessorSqlWorker.test.ts src/services/__tests__/traceProcessorRamBudget.test.ts src/scripts/__tests__/benchmarkTraceProcessorRss.test.ts src/scripts/__tests__/auditTraceProcessorRssMatrix.test.ts src/scripts/__tests__/enterpriseReadinessAudit.test.ts src/scripts/__tests__/enterpriseAcceptanceLoadTest.test.ts src/scripts/__tests__/enterpriseRuntimeIsolationChecklist.test.ts src/scripts/__tests__/enterpriseSecurityAuditChecklist.test.ts src/services/__tests__/analysisRunStore.test.ts src/services/__tests__/agentEventStore.test.ts src/services/__tests__/enterpriseKnowledgeScope.test.ts src/services/__tests__/enterpriseMigration.test.ts src/services/__tests__/runtimeSnapshotStore.test.ts src/services/providerManager/__tests__/localSecretStore.test.ts src/services/providerManager/__tests__/enterpriseProviderStore.test.ts src/services/providerManager/__tests__/providerSnapshot.test.ts src/routes/__tests__/enterpriseTraceMetadataRoutes.test.ts src/routes/__tests__/enterpriseTenantRoutes.test.ts src/routes/__tests__/traceProcessorProxyRoutes.test.ts src/routes/__tests__/enterpriseReportRoutes.test.ts src/routes/__tests__/enterpriseRuntimeDashboardRoutes.test.ts src/routes/__tests__/enterpriseRestartPersistence.test.ts",
|
|
59
59
|
"test:watch": "jest --watch",
|
|
60
60
|
"test:coverage": "jest --coverage",
|
|
61
61
|
"test:unit": "jest --testPathPatterns=src/tests",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"test:scrolling": "tsx src/scripts/runScrollingTest.ts",
|
|
87
87
|
"test:scrolling:real": "tsx src/scripts/runScrollingTestRealData.ts",
|
|
88
88
|
"verify:agent-sse-scrolling": "tsx src/scripts/verifyAgentSseScrolling.ts",
|
|
89
|
-
"verify:e2e:openai-startup": "SMARTPERFETTO_AGENT_RUNTIME=openai-agents-sdk tsx src/scripts/verifyAgentSseScrolling.ts --mode full --trace ../test-traces/lacunh_heavy.pftrace --query \"分析启动性能\" --output test-output/e2e-openai-startup-real.json --keep-session --require-conclusion-evidence --require-claim-verifier-ok --require-non-partial --require-final-report-heading --forbid-process-narration --forbid-degraded-fallback completed_plan_summary_fallback --
|
|
89
|
+
"verify:e2e:openai-startup": "SMARTPERFETTO_AGENT_RUNTIME=openai-agents-sdk tsx src/scripts/verifyAgentSseScrolling.ts --mode full --trace ../test-traces/lacunh_heavy.pftrace --query \"分析启动性能\" --output test-output/e2e-openai-startup-real.json --keep-session --require-conclusion-evidence --require-claim-verifier-ok --require-non-partial --require-final-report-heading --forbid-process-narration --forbid-degraded-fallback completed_plan_summary_fallback --require-text \"冷启动\" --require-text \"ChaosTask\" --forbid-text \"完成综合结论输出\" --forbid-text \"分阶段证据摘要\" --forbid-text \"完整结构化报告已生成\" --forbid-text \"应维持温启动\" --forbid-text \"bindApplication 不存在\"",
|
|
90
90
|
"generate:frontend-types": "tsx scripts/generateFrontendTypes.ts",
|
|
91
91
|
"check:types": "tsx scripts/checkTypesSync.ts",
|
|
92
92
|
"types": "npm run generate:frontend-types"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Android Platform-Tools Slot
|
|
2
|
+
|
|
3
|
+
This directory is reserved for approved bundled ADB binaries used by
|
|
4
|
+
`smp capture android`.
|
|
5
|
+
|
|
6
|
+
Resolution order is:
|
|
7
|
+
|
|
8
|
+
1. `ADB_PATH`
|
|
9
|
+
2. `prebuilts/android-platform-tools/<platform>/adb[.exe]`
|
|
10
|
+
3. `adb` on `PATH`
|
|
11
|
+
|
|
12
|
+
Do not copy Google SDK Platform-Tools binaries here unless the release process
|
|
13
|
+
has explicitly approved the license and redistribution path.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Perfetto Recording Tool Slot
|
|
2
|
+
|
|
3
|
+
This directory is reserved for approved `tracebox` prebuilts used by
|
|
4
|
+
`smp capture android --sideload` and Android devices older than API 29.
|
|
5
|
+
|
|
6
|
+
Expected layout:
|
|
7
|
+
|
|
8
|
+
```text
|
|
9
|
+
prebuilts/perfetto-recording-tools/android-arm64/tracebox
|
|
10
|
+
prebuilts/perfetto-recording-tools/android-arm/tracebox
|
|
11
|
+
prebuilts/perfetto-recording-tools/android-x64/tracebox
|
|
12
|
+
prebuilts/perfetto-recording-tools/android-x86/tracebox
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The pin source is `scripts/perfetto-recording-tools-pin.env`. SmartPerfetto
|
|
16
|
+
does not download these binaries at capture time; use `--tracebox` to point at
|
|
17
|
+
a local binary until approved artifacts are packaged.
|
|
@@ -5,204 +5,167 @@
|
|
|
5
5
|
# =============================================================================
|
|
6
6
|
# CPU 拓扑动态检测 (CPU Topology Detection)
|
|
7
7
|
# =============================================================================
|
|
8
|
-
#
|
|
8
|
+
# Public compatibility wrapper around cpu_topology_view.
|
|
9
9
|
#
|
|
10
|
-
#
|
|
11
|
-
# -
|
|
12
|
-
# -
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
# -
|
|
16
|
-
#
|
|
17
|
-
# 检测方法:
|
|
18
|
-
# - 通过每个 CPU 核心的最大频率推断其类型
|
|
19
|
-
# - 最高频率的 90%+ 归为 prime/big
|
|
20
|
-
# - 60%-90% 归为 mid
|
|
21
|
-
# - 60% 以下归为 little
|
|
10
|
+
# Keep CPU topology inference centralized in `_cpu_topology`; do not maintain
|
|
11
|
+
# another threshold-based classifier here. The shared view:
|
|
12
|
+
# - builds the CPU universe from observed trace evidence first;
|
|
13
|
+
# - ignores stale CPU table rows unless no observed CPU evidence exists;
|
|
14
|
+
# - classifies common Android layouts such as 6+2, 4+3+1, 4+4, 4+2, 4-only,
|
|
15
|
+
# and 10-core tri-cluster layouts from capacity/frequency scale clusters;
|
|
16
|
+
# - keeps unsupported/insufficient scale evidence explicit as `unknown`.
|
|
22
17
|
# =============================================================================
|
|
23
18
|
|
|
24
19
|
name: cpu_topology_detection
|
|
25
20
|
version: "1.0"
|
|
26
|
-
type:
|
|
21
|
+
type: composite
|
|
27
22
|
category: hardware
|
|
28
23
|
tier: B
|
|
29
24
|
|
|
30
25
|
meta:
|
|
31
26
|
display_name: "CPU 拓扑检测"
|
|
32
|
-
description: "
|
|
27
|
+
description: "基于共享 _cpu_topology 视图检测 CPU 大小核拓扑"
|
|
33
28
|
icon: "memory"
|
|
34
29
|
tags: [cpu, topology, cluster, atomic]
|
|
35
30
|
|
|
36
|
-
prerequisites:
|
|
37
|
-
required_tables:
|
|
38
|
-
- counter
|
|
39
|
-
- cpu_counter_track
|
|
40
|
-
|
|
41
31
|
inputs:
|
|
42
32
|
- name: start_ts
|
|
43
33
|
type: timestamp
|
|
44
34
|
required: false
|
|
45
|
-
description: "
|
|
35
|
+
description: "分析起始时间(保留兼容;共享拓扑检测使用整条 trace 的观测证据)"
|
|
46
36
|
- name: end_ts
|
|
47
37
|
type: timestamp
|
|
48
38
|
required: false
|
|
49
|
-
description: "
|
|
39
|
+
description: "分析结束时间(保留兼容;共享拓扑检测使用整条 trace 的观测证据)"
|
|
50
40
|
|
|
51
41
|
steps:
|
|
52
|
-
|
|
42
|
+
- id: init_cpu_topology
|
|
43
|
+
type: skill
|
|
44
|
+
name: "初始化 CPU 拓扑"
|
|
45
|
+
skill: cpu_topology_view
|
|
46
|
+
display:
|
|
47
|
+
level: hidden
|
|
48
|
+
optional: true
|
|
49
|
+
|
|
53
50
|
- id: detect_cpu_clusters
|
|
54
51
|
type: atomic
|
|
55
52
|
name: "检测 CPU 集群"
|
|
56
53
|
display:
|
|
57
54
|
level: summary
|
|
55
|
+
layer: overview
|
|
58
56
|
title: "CPU 拓扑检测结果"
|
|
57
|
+
columns:
|
|
58
|
+
- name: cpu
|
|
59
|
+
label: "CPU"
|
|
60
|
+
type: number
|
|
61
|
+
- name: cluster_type
|
|
62
|
+
label: "核心类型"
|
|
63
|
+
type: string
|
|
64
|
+
- name: max_freq_mhz
|
|
65
|
+
label: "Max Freq"
|
|
66
|
+
type: number
|
|
67
|
+
- name: capacity
|
|
68
|
+
label: "Capacity"
|
|
69
|
+
type: number
|
|
70
|
+
- name: topology_source
|
|
71
|
+
label: "判定来源"
|
|
72
|
+
type: string
|
|
73
|
+
- name: cluster_rank
|
|
74
|
+
label: "簇档位"
|
|
75
|
+
type: number
|
|
76
|
+
- name: cluster_count
|
|
77
|
+
label: "簇数量"
|
|
78
|
+
type: number
|
|
59
79
|
sql: |
|
|
60
|
-
WITH
|
|
61
|
-
-- 获取时间范围
|
|
62
|
-
time_bounds AS (
|
|
63
|
-
SELECT
|
|
64
|
-
COALESCE(${start_ts}, (SELECT MIN(ts) FROM counter)) as start_ts,
|
|
65
|
-
COALESCE(${end_ts}, (SELECT MAX(ts) FROM counter)) as end_ts
|
|
66
|
-
),
|
|
67
|
-
-- 获取每个 CPU 的最大频率
|
|
68
|
-
cpu_max_freq AS (
|
|
69
|
-
SELECT
|
|
70
|
-
t.cpu,
|
|
71
|
-
MAX(c.value) as max_freq_khz,
|
|
72
|
-
MIN(c.value) as min_freq_khz,
|
|
73
|
-
AVG(c.value) as avg_freq_khz,
|
|
74
|
-
COUNT(*) as sample_count
|
|
75
|
-
FROM counter c
|
|
76
|
-
JOIN cpu_counter_track t ON c.track_id = t.id
|
|
77
|
-
WHERE t.name = 'cpufreq'
|
|
78
|
-
AND c.ts >= (SELECT start_ts FROM time_bounds)
|
|
79
|
-
AND c.ts <= (SELECT end_ts FROM time_bounds)
|
|
80
|
-
GROUP BY t.cpu
|
|
81
|
-
),
|
|
82
|
-
-- 获取全局最大频率用于计算比例
|
|
83
|
-
global_max AS (
|
|
84
|
-
SELECT MAX(max_freq_khz) as global_max_freq FROM cpu_max_freq
|
|
85
|
-
),
|
|
86
|
-
-- 根据最大频率比例推断集群类型
|
|
87
|
-
cpu_clusters AS (
|
|
88
|
-
SELECT
|
|
89
|
-
cpu,
|
|
90
|
-
max_freq_khz,
|
|
91
|
-
min_freq_khz,
|
|
92
|
-
ROUND(max_freq_khz / 1000.0, 0) as max_freq_mhz,
|
|
93
|
-
ROUND(100.0 * max_freq_khz / (SELECT global_max_freq FROM global_max), 1) as freq_ratio_pct,
|
|
94
|
-
CASE
|
|
95
|
-
-- 最高频率的 90%+ 归为 prime (超大核)
|
|
96
|
-
WHEN max_freq_khz >= (SELECT global_max_freq FROM global_max) * 0.95 THEN 'prime'
|
|
97
|
-
-- 75%-95% 归为 big (大核)
|
|
98
|
-
WHEN max_freq_khz >= (SELECT global_max_freq FROM global_max) * 0.75 THEN 'big'
|
|
99
|
-
-- 50%-75% 归为 mid (中核)
|
|
100
|
-
WHEN max_freq_khz >= (SELECT global_max_freq FROM global_max) * 0.50 THEN 'mid'
|
|
101
|
-
-- 50% 以下归为 little (小核)
|
|
102
|
-
ELSE 'little'
|
|
103
|
-
END as cluster_type,
|
|
104
|
-
sample_count
|
|
105
|
-
FROM cpu_max_freq
|
|
106
|
-
)
|
|
107
80
|
SELECT
|
|
108
|
-
cpu,
|
|
109
|
-
cluster_type,
|
|
110
|
-
max_freq_mhz,
|
|
111
|
-
|
|
112
|
-
|
|
81
|
+
cpu_id as cpu,
|
|
82
|
+
core_type as cluster_type,
|
|
83
|
+
CASE WHEN max_freq IS NULL THEN NULL ELSE ROUND(max_freq / 1000.0, 0) END as max_freq_mhz,
|
|
84
|
+
capacity,
|
|
85
|
+
topology_source,
|
|
86
|
+
cluster_rank,
|
|
87
|
+
cluster_count,
|
|
88
|
+
CASE core_type
|
|
113
89
|
WHEN 'prime' THEN '超大核'
|
|
114
90
|
WHEN 'big' THEN '大核'
|
|
115
|
-
WHEN '
|
|
116
|
-
|
|
91
|
+
WHEN 'medium' THEN '中核'
|
|
92
|
+
WHEN 'little' THEN '小核'
|
|
93
|
+
ELSE '未知'
|
|
117
94
|
END as cluster_type_cn
|
|
118
|
-
FROM
|
|
119
|
-
ORDER BY
|
|
95
|
+
FROM _cpu_topology
|
|
96
|
+
ORDER BY
|
|
97
|
+
CASE core_type
|
|
98
|
+
WHEN 'prime' THEN 1
|
|
99
|
+
WHEN 'big' THEN 2
|
|
100
|
+
WHEN 'medium' THEN 3
|
|
101
|
+
WHEN 'little' THEN 4
|
|
102
|
+
ELSE 5
|
|
103
|
+
END,
|
|
104
|
+
cpu_id
|
|
120
105
|
save_as: cpu_clusters
|
|
121
106
|
|
|
122
|
-
# Step 2: 集群汇总
|
|
123
107
|
- id: cluster_summary
|
|
124
108
|
type: atomic
|
|
125
109
|
name: "集群汇总"
|
|
126
110
|
display:
|
|
127
111
|
level: summary
|
|
112
|
+
layer: overview
|
|
128
113
|
title: "CPU 集群汇总"
|
|
114
|
+
columns:
|
|
115
|
+
- name: cluster_type
|
|
116
|
+
label: "核心类型"
|
|
117
|
+
type: string
|
|
118
|
+
- name: cpu_count
|
|
119
|
+
label: "CPU 数"
|
|
120
|
+
type: number
|
|
121
|
+
- name: cpus
|
|
122
|
+
label: "CPU 列表"
|
|
123
|
+
type: string
|
|
124
|
+
- name: max_freq_mhz
|
|
125
|
+
label: "最高频率"
|
|
126
|
+
type: number
|
|
127
|
+
- name: min_freq_mhz
|
|
128
|
+
label: "最低频率"
|
|
129
|
+
type: number
|
|
130
|
+
- name: topology_source
|
|
131
|
+
label: "判定来源"
|
|
132
|
+
type: string
|
|
129
133
|
sql: |
|
|
130
|
-
WITH
|
|
131
|
-
cpu_max_freq AS (
|
|
132
|
-
SELECT
|
|
133
|
-
t.cpu,
|
|
134
|
-
MAX(c.value) as max_freq_khz
|
|
135
|
-
FROM counter c
|
|
136
|
-
JOIN cpu_counter_track t ON c.track_id = t.id
|
|
137
|
-
WHERE t.name = 'cpufreq'
|
|
138
|
-
GROUP BY t.cpu
|
|
139
|
-
),
|
|
140
|
-
global_max AS (
|
|
141
|
-
SELECT MAX(max_freq_khz) as global_max_freq FROM cpu_max_freq
|
|
142
|
-
),
|
|
143
|
-
cpu_clusters AS (
|
|
144
|
-
SELECT
|
|
145
|
-
cpu,
|
|
146
|
-
max_freq_khz,
|
|
147
|
-
CASE
|
|
148
|
-
WHEN max_freq_khz >= (SELECT global_max_freq FROM global_max) * 0.95 THEN 'prime'
|
|
149
|
-
WHEN max_freq_khz >= (SELECT global_max_freq FROM global_max) * 0.75 THEN 'big'
|
|
150
|
-
WHEN max_freq_khz >= (SELECT global_max_freq FROM global_max) * 0.50 THEN 'mid'
|
|
151
|
-
ELSE 'little'
|
|
152
|
-
END as cluster_type
|
|
153
|
-
FROM cpu_max_freq
|
|
154
|
-
)
|
|
155
134
|
SELECT
|
|
156
|
-
cluster_type,
|
|
135
|
+
core_type as cluster_type,
|
|
157
136
|
COUNT(*) as cpu_count,
|
|
158
|
-
GROUP_CONCAT(
|
|
159
|
-
ROUND(MAX(
|
|
160
|
-
ROUND(MIN(
|
|
161
|
-
|
|
137
|
+
GROUP_CONCAT(cpu_id, ', ') as cpus,
|
|
138
|
+
CASE WHEN MAX(max_freq) IS NULL THEN NULL ELSE ROUND(MAX(max_freq) / 1000.0, 0) END as max_freq_mhz,
|
|
139
|
+
CASE WHEN MIN(max_freq) IS NULL THEN NULL ELSE ROUND(MIN(max_freq) / 1000.0, 0) END as min_freq_mhz,
|
|
140
|
+
GROUP_CONCAT(DISTINCT topology_source) as topology_source,
|
|
141
|
+
CASE core_type
|
|
162
142
|
WHEN 'prime' THEN 1
|
|
163
143
|
WHEN 'big' THEN 2
|
|
164
|
-
WHEN '
|
|
165
|
-
|
|
144
|
+
WHEN 'medium' THEN 3
|
|
145
|
+
WHEN 'little' THEN 4
|
|
146
|
+
ELSE 5
|
|
166
147
|
END as cluster_order
|
|
167
|
-
FROM
|
|
168
|
-
GROUP BY
|
|
148
|
+
FROM _cpu_topology
|
|
149
|
+
GROUP BY core_type
|
|
169
150
|
ORDER BY cluster_order
|
|
170
151
|
save_as: cluster_summary
|
|
171
152
|
|
|
172
|
-
# Step 3: 导出供其他 skill 使用的集群映射
|
|
173
153
|
- id: cluster_mapping
|
|
174
154
|
type: atomic
|
|
175
155
|
name: "集群映射"
|
|
176
156
|
sql: |
|
|
177
|
-
WITH
|
|
178
|
-
cpu_max_freq AS (
|
|
179
|
-
SELECT
|
|
180
|
-
t.cpu,
|
|
181
|
-
MAX(c.value) as max_freq_khz
|
|
182
|
-
FROM counter c
|
|
183
|
-
JOIN cpu_counter_track t ON c.track_id = t.id
|
|
184
|
-
WHERE t.name = 'cpufreq'
|
|
185
|
-
GROUP BY t.cpu
|
|
186
|
-
),
|
|
187
|
-
global_max AS (
|
|
188
|
-
SELECT MAX(max_freq_khz) as global_max_freq FROM cpu_max_freq
|
|
189
|
-
)
|
|
190
157
|
SELECT
|
|
191
|
-
cpu,
|
|
192
|
-
max_freq_khz,
|
|
158
|
+
cpu_id as cpu,
|
|
159
|
+
max_freq as max_freq_khz,
|
|
160
|
+
core_type as cluster_type,
|
|
193
161
|
CASE
|
|
194
|
-
WHEN
|
|
195
|
-
WHEN
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
WHEN max_freq_khz >= (SELECT global_max_freq FROM global_max) * 0.60 THEN 'big'
|
|
202
|
-
ELSE 'little'
|
|
203
|
-
END as simple_cluster_type
|
|
204
|
-
FROM cpu_max_freq
|
|
205
|
-
ORDER BY cpu
|
|
162
|
+
WHEN core_type IN ('prime', 'big', 'medium') THEN 'big'
|
|
163
|
+
WHEN core_type = 'little' THEN 'little'
|
|
164
|
+
ELSE 'unknown'
|
|
165
|
+
END as simple_cluster_type,
|
|
166
|
+
topology_source
|
|
167
|
+
FROM _cpu_topology
|
|
168
|
+
ORDER BY cpu_id
|
|
206
169
|
save_as: cluster_mapping
|
|
207
170
|
|
|
208
171
|
output:
|
|
@@ -214,20 +177,3 @@ output:
|
|
|
214
177
|
description: "集群汇总(每种类型的核心数)"
|
|
215
178
|
- name: cluster_mapping
|
|
216
179
|
description: "集群映射表(供其他 skill 使用)"
|
|
217
|
-
|
|
218
|
-
# =============================================================================
|
|
219
|
-
# 使用示例
|
|
220
|
-
# =============================================================================
|
|
221
|
-
# 其他 skill 可以通过以下 CTE 使用动态检测的集群:
|
|
222
|
-
#
|
|
223
|
-
# WITH cpu_clusters AS (
|
|
224
|
-
# -- 复制 cluster_mapping 的 SQL
|
|
225
|
-
# )
|
|
226
|
-
# SELECT
|
|
227
|
-
# CASE
|
|
228
|
-
# WHEN cpu IN (SELECT cpu FROM cpu_clusters WHERE cluster_type = 'prime') THEN 'prime'
|
|
229
|
-
# WHEN cpu IN (SELECT cpu FROM cpu_clusters WHERE cluster_type = 'big') THEN 'big'
|
|
230
|
-
# WHEN cpu IN (SELECT cpu FROM cpu_clusters WHERE cluster_type = 'mid') THEN 'mid'
|
|
231
|
-
# ELSE 'little'
|
|
232
|
-
# END as core_type
|
|
233
|
-
# FROM ...
|
|
@@ -194,6 +194,7 @@ steps:
|
|
|
194
194
|
cs.scale_bucket,
|
|
195
195
|
CASE
|
|
196
196
|
WHEN cs.scale_bucket IS NULL OR cs.scale_bucket <= 0 THEN 'unknown'
|
|
197
|
+
WHEN sc.cluster_count <= 1 AND (SELECT COUNT(*) FROM cpu_scale) <= 4 THEN 'little'
|
|
197
198
|
WHEN sc.cluster_count <= 1 THEN 'unknown'
|
|
198
199
|
WHEN sc.cluster_count = 2 AND sc.cluster_rank = sc.cluster_count THEN 'big'
|
|
199
200
|
WHEN sc.cluster_rank = 1 THEN 'little'
|
|
@@ -205,6 +206,7 @@ steps:
|
|
|
205
206
|
END as core_type,
|
|
206
207
|
CASE
|
|
207
208
|
WHEN cs.scale_bucket IS NULL OR cs.scale_bucket <= 0 THEN cs.topology_source
|
|
209
|
+
WHEN sc.cluster_count <= 1 AND (SELECT COUNT(*) FROM cpu_scale) <= 4 THEN cs.topology_source || '_uniform_four_little'
|
|
208
210
|
WHEN sc.cluster_count <= 1 THEN cs.topology_source || '_uniform'
|
|
209
211
|
ELSE cs.topology_source
|
|
210
212
|
END as topology_source,
|
|
@@ -8,7 +8,9 @@ Now output only the final report body. The first line must be `## Final Conclusi
|
|
|
8
8
|
The report must include: final conclusion, key evidence chain, root-cause breakdown, ruled-out factors, recommendations, and confidence/limitations.
|
|
9
9
|
|
|
10
10
|
Continue to obey the scene strategy, Final Report Contract, and latest next_phase_reminder constraints from this run. If the scene strategy or contract requires root-cause distributions, representative samples, phase-duration breakdowns, dual-audience recommendations, architecture branch judgments, or any other scene-specific structure, keep that structure in the final report instead of compressing it into a short summary.
|
|
11
|
+
When the Final Report Contract names required items, prefer explicit matching sections or labels, for example "Phase Duration Breakdown", "[App Layer]", and "[System/Platform Layer]", instead of only implying those items inside prose.
|
|
12
|
+
Output all structures required by the Final Report Contract before long trees, appendices, or expanded details. Do not place required recommendations, audience/layered recommendations, or limitations after a long code block or long tree where a truncated report could lose key conclusions.
|
|
11
13
|
|
|
12
14
|
Do not merely restate phase summaries; synthesize the collected concrete values and evidence into a readable conclusion.
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
Prioritize completeness. Use compact aggregation tables where helpful; do not expand into a phase-by-phase log, do not copy raw artifact tables, do not output the data-source/evidence-table index because the system will generate it, and do not repeat raw SQL. When evidence is abundant, prioritize the key evidence chain, structures required by the scene contract, and the highest-priority root causes; do not omit key conclusions or evidence just to shorten the report.
|
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
报告必须包含:综合结论、关键证据链、根因拆解、已排除因素、优化建议、置信度/限制。
|
|
9
9
|
|
|
10
10
|
必须继续遵守本轮场景策略、Final Report Contract 和最后一个 next_phase_reminder 的输出约束。若场景策略或契约要求根因分布、代表样本、阶段耗时拆分、双受众建议、架构分支判断或其他专属结构,最终报告必须保留这些结构,不能降级为短摘要。
|
|
11
|
+
如果 Final Report Contract 给出了必检项名称,优先用同名小节或清晰标签呈现,例如“阶段耗时分解”、“[App层]”、“[系统/平台层]”,避免只把契约内容隐含在叙述里。
|
|
12
|
+
先输出 Final Report Contract 要求的必需结构,再输出长树状图、附录或扩展说明;不要把必需的优化建议、分层建议、限制说明放在长代码块或长树之后,以免报告中途截断时缺失关键结论。
|
|
11
13
|
|
|
12
14
|
不要只复述阶段摘要;必须把已采集到的具体数值和证据串成可读结论。
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
完整性优先。可以用小型聚合表压缩信息;不要展开逐阶段流水账,不要复制 artifact 原表,不要重复 SQL 原文,不要输出“数据来源索引/证据表索引”(系统会自动生成)。若证据很多,优先保留关键证据链、场景契约要求的结构和最高优先级根因,不要为了压缩长度裁剪关键结论或证据。
|
|
@@ -84,7 +84,7 @@ graph LR
|
|
|
84
84
|
```
|
|
85
85
|
|
|
86
86
|
### 结论结构
|
|
87
|
-
|
|
87
|
+
结论必须完整但克制:优先输出能支撑决策的证据链,避免把已经展示过的大表逐行搬进最终报告。如果证据很多,用聚合表和证据索引压缩,降低重复信息密度;不要为了压缩长度裁剪关键结论或证据,也不要生成会在 token 上限处截断的超长报告。
|
|
88
88
|
|
|
89
89
|
1. **概览**: 一句话总结性能状况。如果架构检测置信度 < 80%,在概览中标注(如"⚠️ 架构检测置信度 50%,分析策略可能不完全匹配"),帮助用户理解分析的局限性
|
|
90
90
|
2. **关键发现**: 按严重程度排列的发现列表(含根因推理链 + 📚 背景知识)
|
|
@@ -50,7 +50,7 @@ final_report_contract:
|
|
|
50
50
|
label: 阶段耗时分解
|
|
51
51
|
description: '包含 startup_detail / phase breakdown 口径,并优先使用 self_ms 解释阶段贡献。'
|
|
52
52
|
pattern_groups:
|
|
53
|
-
- ['阶段耗时', '阶段分解', 'phase\s+breakdown', 'startup_detail']
|
|
53
|
+
- ['阶段耗时', '阶段分解', 'phase\s+breakdown', 'startup_detail', '根因分析树', 'Phase\s*\d+']
|
|
54
54
|
- ['self_ms', 'dur_ms', '耗时', '\d+(?:\.\d+)?\s*ms']
|
|
55
55
|
- id: root_cause_references
|
|
56
56
|
label: 根因编号引用
|
|
@@ -61,8 +61,8 @@ final_report_contract:
|
|
|
61
61
|
label: App/系统分层建议
|
|
62
62
|
description: '优化建议必须区分 App 层和系统/平台/ROM 层。'
|
|
63
63
|
pattern_groups:
|
|
64
|
-
- ['App
|
|
65
|
-
- ['
|
|
64
|
+
- ['App\s*层', '应用\s*层', 'App\s+layer']
|
|
65
|
+
- ['系统\s*/\s*平台\s*层', '系统\s*层', '平台\s*层', 'ROM\s*层', 'System/Platform', 'platform\s+layer']
|
|
66
66
|
|
|
67
67
|
phase_hints:
|
|
68
68
|
- id: detail_breakdown
|
|
@@ -644,7 +644,7 @@ TTID 和 TTFD 是两个不同的指标,必须区分:
|
|
|
644
644
|
- **数据不足时**:标注"数据不足,无法归类"而非强行贴标签
|
|
645
645
|
- **纯排除项**:编号可选(如"Binder 阻塞(B6) < 10ms ✓")
|
|
646
646
|
|
|
647
|
-
3. **根因分析树**:层级式展示启动耗时分解,**必须体现嵌套关系、使用 self_ms
|
|
647
|
+
3. **根因分析树**:层级式展示启动耗时分解,**必须体现嵌套关系、使用 self_ms、标注根因编号**。树可以保持紧凑;不要让长树状图挤掉后面的 App/系统分层建议。
|
|
648
648
|
```
|
|
649
649
|
启动总耗时 XXms
|
|
650
650
|
├── [Phase 1] bindApplication = XXms wall
|