Conversation
refactor: merge post-refactoring fixes and improvements into master
refactor: merge P0 fixes and architecture improvements
refactor: P0 quality fixes, collector enhancements, and tooling improvements
…accuracy - Extract actual method names from anonymous inner class names (e.g. Outer$1) and stack traces, storing the enclosing method as context_method - Tag XML layout inflate calls as [XML布局] with call count and total time - Reorder report sections to put attribution data first, preventing truncation of core input when total content exceeds token budget - Add completeness check rule to report prompt to avoid missing entries - Switch CLI entry point to graph module and add hatchling build config Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
refactor: 工具增强与匿名内部类归因支持
Covers plugin system, URL API, postMessage, trace_processor HTTP mode, proposed local Web Server bridge architecture, and integration plan with existing LangGraph pipeline. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Document the perfetto-plugin/build.sh usage, prerequisites, build steps, and the --skip-clone flag for incremental builds. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…fetto UI Add SI Bridge plugin for Perfetto UI enabling interactive frame-level analysis: users select a time range in Perfetto UI and get AI-powered analysis with source attribution via WebSocket bridge. New components: - perfetto-plugin/: TypeScript plugin + build.sh for self-hosted Perfetto UI - frame_analyzer agent: queries slice data, runs attribution, LLM analysis - bridge_server: serves Perfetto UI + WebSocket bridge to CLI agent - /open, /close, /frame CLI commands - HDC command-line research doc for HarmonyOS support Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
feat: Perfetto UI 交互帧分析 + 工具链增强 + 文档更新
Replace report example with actual 2026-04-15 analysis output, update quick start examples, improve table alignment, clean up Todo checkbox syntax, and remove unreferenced screenshot. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
docs: update README and add Perfetto UI interactive analysis docs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…te analysis Add a fast path in attributor that skips LLM for straightforward java type searches using direct Glob→Grep→Read. This reduces latency and cost for cases without anonymous inner classes or unknown methods. Add thread state analysis to perfetto collector that shows Running/S/D distribution per SI$ slow slice, helping distinguish slow code from blocked threads. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Feat/call stack attribution
# Conflicts: # src/smartinspector/agents/attributor.py
…r class handling - Fix SI$block# slices (dur≈0) being squeezed out by LIMIT 50 SQL query: split into two queries prioritizing SI$ slices over system slices - Fix anonymous inner class method resolution: always set context_method from _extract_method_from_anonymous, only override method_name with stack - Add lightweight LLM analysis (_analyze_snippets) for fast-path results to replace raw source code with analysis text in source_snippet - Fix _build_frame_hints: sort SI$ slices by effective dur DESC, aggregate repeated calls with cumulative duration and call count - Fix dur extraction from SI$block# tag suffix (#NNms) in frame_analyzer - Filter out negligible dur slices (< 0.01ms) from attribution - Show "(匿名内部类, 定义在 method 内)" label for inner class results - Add debug logging for Step 3 LLM input/output Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The previous query required thread_state entries to be entirely within the slice window (ts >= start AND ts + dur <= end), which missed almost all entries since thread_state records commonly straddle slice boundaries (e.g. a long Running state starting before the slice). Changed to overlap-based calculation: SUM(MIN(end, slice_end) - MAX(start, slice_start)) with proper handling for dur < 0 (still-running entries). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Two bugs in collect_thread_state state normalization: 1. State distribution used overwrite instead of accumulation: when multiple raw states mapped to the same normalized name (e.g. R and R+ both → Running), the second would overwrite the first instead of summing. This caused incorrect percentages when both R and R+ appeared. 2. S+ state was not mapped to Sleeping: S+ (interruptible sleep, preemptible) is common in Android apps but was left as-is instead of being normalized to "Sleeping". Added comprehensive tests for normalization, overlap calculation, and filter conditions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…s, and perfetto auto-degradation P1-4: Add dependency reference search in Attributor Agent — after finding target files, extract import statements for project-internal classes and R.layout XML references, read related files, and include as dependency_context for richer AI diagnosis. P1-5: Add package_list cold-start fallback — new _resolve_target_process() method tries process table first, falls back to package_list table for UID lookup when process table is empty during cold start. Annotates view_slices with target process info and includes resolved process in metadata. P1-6: Add SELinux cat-pipe bypass — when stdin-pipe perfetto config fails, fallback to pushing config file and using cat pipe (cat config | perfetto -c -). P1-7: Add perfetto collection auto-degradation — when config mode fails entirely, degrade to simpler cmdline mode with just atrace categories. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add design document for thread state blocking analysis and redesign.
Added project rules, overview, structure, conventions, logging rules, architecture, commands, configuration, known issues, and build notes to CLAUDE.md.
…ead_state for blocking details Replace sched-based thread state inference with __intrinsic_thread_state table queries that expose blocked_function, io_wait, and waker_utid fields. This enables actionable blocking analysis instead of generic Running/Sleeping labels. Falls back to legacy thread_state table when __intrinsic_thread_state is unavailable. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
feat: metric QA, startup analysis, attribution improvements, and collector bug fixes
- Create si_tag.py with SITag dataclass and parse_si_tag() function
that does single-pass parsing of all SI$ tag types (block, RV,
inflate, view, handler, db, net, img, touch, default)
- Rewrite extract_class(), extract_method(), extract_fqn() as thin
wrappers around parse_si_tag(), eliminating ~280 lines of duplicated
parsing logic from attribution.py
- Move _split_fqn_method, _extract_method_from_anonymous, system class
constants to si_tag.py as single source of truth
- Add SITag.is_system and SITag.is_system_method properties for
declarative system class checking
- Rewrite is_system_class(), is_system_method(), classify_search_type()
to use parse_si_tag() internally
- Add 90 new unit tests:
- test_si_tag.py: 63 tests covering all SI$ tag types, edge cases,
backward-compatible wrappers, and integration
- test_deterministic.py: 27 tests for severity classification,
call-chain distribution, RV hotspots, CPU hotspots, thread state,
IO slices, memory analysis, frame budget detection, compute_hints
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…tup, GC, ANR) Implements 6 new collection methods in PerfettoCollector using Perfetto stdlib modules: - collect_lock_contention (android.monitor_contention) - collect_binder_txns (android.binder) - collect_binder_breakdown (android.binder_breakdown) - collect_startup_metrics (android.startup.startups + time_to_display) - collect_gc_events (android.garbage_collection) - collect_anrs (android.anrs) Each method uses INCLUDE PERFETTO MODULE, filters by target process upid, and returns structured dicts compatible with the existing pipeline. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ry, util, SF) Implements 6 additional collection methods using Perfetto stdlib modules: - collect_slice_cpu_time (slices.cpu_time) - collect_input_latency (android.input) - collect_sched_latency (sched.latency) - collect_oom_rss_swap (android.memory.process + android.memory.lmk) - collect_cpu_utilization (linux.cpu.utilization.process) - collect_surfaceflinger_timeline (android.surfaceflinger) All methods use INCLUDE PERFETTO MODULE, filter by target process, and handle missing tables gracefully. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Wire up all 11 stdlib collect methods into the summarize() pipeline
and add corresponding fields to PerfSummary, so they are included
in the JSON output consumed by the AI agent.
P0: lock_contention, binder_txns, startup_metrics, gc_events, anrs
P1: slice_cpu_time, input_latency, sched_latency, oom_rss_swap,
cpu_utilization, surfaceflinger_timeline
P0: LockContention, BinderCalls, GcStress, AnrTrigger, ColdStart P1: InputLatency, MemoryPressure, SchedLatency - MainActivity updated with scenario list launcher - AndroidManifest.xml updated with all new activities - ColdStartActivity exported=true for adb am start
…ministic pipeline Add _analyze_lock_contention, _analyze_binder_txns, _analyze_startup_metrics, _analyze_gc_events, _analyze_anrs, _analyze_input_latency, _analyze_sched_latency, _analyze_oom_rss_swap to compute_hints(). Update perf-analyzer.txt prompt with new pre-computed section descriptions and analysis methods. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…elpers
The collect_* methods return wrapped dicts (e.g. {total_count, top_contentions})
but deterministic helpers were iterating them as if they were flat lists.
Now correctly extract the inner list from each dict wrapper.
Fixes #14
…alysis helpers" This reverts commit f3f307e.
…er lists from wrapped dicts Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…e coverage Add binder ftrace events (binder_transaction, binder_lock/unlock) for android.binder and monitor_contention analysis. Add kmem reclaim event for LMK context, sched_process_exec for task lifecycle, and android.input.inputevent data source for input latency analysis. Increase buffer to 131072 KB, reduce proc_stats poll to 1000ms for finer memory granularity, and add atrace categories (adb, binder_driver, lock_dep) for deeper system tracing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix atrace_categories protobuf format: use separate lines per category instead of comma-separated single string, which prevented lock contention events from being captured (android.monitor_contention table empty) - Unify /analyze command to route through full pipeline (collector → analyzer → attributor → reporter) matching headless --cmd analyze behavior - Skip WS app connection wait when pre-loaded trace file is provided, avoiding unnecessary 30s timeout in /analyze and headless modes - Add module-level _headless_trace_path fallback for LangGraph 1.1.3 state merge issue where _trace_path is lost between orchestrator → collector - Add _trace_path to _PASS_THROUGH_KEYS for state preservation - Map headless analyze command to RouteDecision.FULL_ANALYSIS - Update report-generator prompt to preserve existing perf_analysis P0/P1/P2 issues in final report output - Add debug logging for Perfetto adb commands and textproto config - Add LLM request/response logging via BaseCallbackHandler in debug mode Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
feat: integrate Perfetto SQL stdlib modules (P0+P1)
Add an MCP Server (si-mcp entry point) that exposes all 23 CLI commands as MCP tools for external agents (Claude Desktop, OpenClaw, etc.) via stdio transport. Includes full documentation in docs/mcp-server.md and updates CLAUDE.md with MCP Server section. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add optional source_dir parameter to si_full, si_trace, si_analyze, si_frame, si_startup, and si_quick tools, allowing callers to specify the source code directory for attribution during analysis. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add si_init as a one-time setup entry point that configures source_dir, api_key, base_url, and model globally for all subsequent tool calls. Analysis tools retain optional source_dir override. Replace _apply_source_dir with _global_config + _apply_global_config for broader config propagation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…interfaces si_init now accepts target_process and debug parameters, unifying all global configuration in one place. Analysis tools (si_full, si_trace, si_record, si_analyze, si_frame, si_startup, si_quick, si_ci_analyze) drop redundant source_dir/debug/no_wait params and read from _global_config instead. package_name is kept as a runtime override. _apply_global_config() simplified to take no arguments. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
uv run does not support module:function format. Use the registered entry point name "si-mcp" instead of "smartinspector.mcp_server:main". Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Feat/mcp server
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
feat(mcp): add MCP Server exposing all SI commands as tools
Multi-stage Dockerfile (builder → si-analyzer → si-mcp) with uv dependency management and Linux trace_processor_shell download. docker-compose.yml provides 4 services (ci/mcp/dev/prod) with profile-based activation. Includes .dockerignore, .env.docker.example, and healthcheck script. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Upgrade Perfetto from v49.0 to v55.1, switch to CI artifact URL - Add TARGETARCH build arg for multi-platform (amd64/arm64) support - Fix pip install to use venv python, switch to non-editable install - Symlink prompts dir to venv for correct runtime path resolution - Use 'smartinspector' entrypoint instead of 'python -m' - Add README.md to COPY steps, simplify uv install flags Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Feature/docker deploy
feat(docker): add Docker containerization support
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.