Skip to content

Xcode AI profiler tools#5

Open
DamianMarkowski wants to merge 5 commits into
masterfrom
cursor/xcode-ai-profiler-tools-7ad9
Open

Xcode AI profiler tools#5
DamianMarkowski wants to merge 5 commits into
masterfrom
cursor/xcode-ai-profiler-tools-7ad9

Conversation

@DamianMarkowski
Copy link
Copy Markdown
Owner

Add 5 new profiler tools (Energy, Network, Hangs, Startup, Disk I/O) to expand Xcode Instruments-based analysis capabilities.


Open in Web Open in Cursor 

cursoragent and others added 4 commits March 3, 2026 08:23
…ile Activity

Implement five new static binary analyzers that map to real Xcode Instruments:

- EnergyAnalyzer: Detects battery-draining patterns including continuous
  location tracking, excessive timers, CADisplayLink without frame rate
  limiting, background processing, sensor usage, and CPU-intensive work.

- NetworkAnalyzer: Identifies networking issues including plaintext HTTP
  URLs, missing certificate pinning, no response caching, multiple
  networking frameworks, WebSocket without heartbeat, and serialization
  inefficiencies.

- HangsAnalyzer: Finds main-thread-blocking patterns including synchronous
  I/O, synchronous network requests (critical), heavy computation, complex
  view hierarchies, missing prefetching/diffable data sources, and Core
  Data on main thread.

- StartupAnalyzer: Analyzes launch time factors including static
  initializers, linked framework count, ObjC class registration overhead,
  binary size impact, Swift metadata processing, eager SDK initialization,
  and Core Data migration at launch.

- DiskIOAnalyzer: Profiles file system access including synchronous file
  ops, large file handling, Core Data batch operations, SQLite WAL mode,
  file coordination for app groups, temp file cleanup, file protection,
  and logging I/O patterns.

Each analyzer follows the same pattern as existing ones: 8 detection
categories, confidence scoring, severity-weighted health score, and
detailed metadata.

Update InstrumentType enum with 5 new cases including icons, colors,
gradients, subtitles, and descriptions. Update AnalysisEngine to
orchestrate all 8 analyzers with adjusted progress tracking.

Co-authored-by: Damian Markowski <DamianMarkowski@users.noreply.github.com>
Add comprehensive test suites for each new analyzer:
- EnergyAnalyzerTests: 11 tests covering location, timers, background
  processing, network config, sensors, CPU intensity, scoring, metadata
- NetworkAnalyzerTests: 13 tests covering HTTP detection, pinning,
  caching, frameworks, WebSocket, JSON, sessions, transfers, scoring
- HangsAnalyzerTests: 12 tests covering sync I/O, heavy computation,
  view hierarchy, scroll perf, locking, image decoding, Core Data, scoring
- StartupAnalyzerTests: 12 tests covering static inits, frameworks,
  ObjC classes, binary size, conformances, SDK inits, migration, scoring
- DiskIOAnalyzerTests: 13 tests covering sync I/O, file handling, Core
  Data, SQLite, file coordination, temp files, protection, logging, scoring

Update existing tests:
- ModelTests: Update InstrumentType count from 3 to 8, add raw value checks
- AnalysisEngineTests: Update result count from 3 to 8, add result
  accessor checks for all new instruments

Co-authored-by: Damian Markowski <DamianMarkowski@users.noreply.github.com>
Add intentional issue patterns for each new analyzer:
- EnergyExamples: Continuous GPS, excessive timers, CADisplayLink,
  background tasks, motion sensors, CPU-intensive processing
- NetworkExamples: Plaintext HTTP URLs, shared session only, no
  certificate pinning, WebSocket without heartbeat, heavy JSON
- HangsExamples: Sync file I/O, sync network, heavy sorting, deep
  view hierarchies, no prefetch, main thread locks, Core Data on main
- StartupExamples: Eager singletons, multiple SDK inits, heavy
  AppDelegate work, global state initializers
- DiskIOExamples: Sync file ops, full file reads, Core Data without
  batching, SQLite without WAL, temp files, no file protection,
  app group without coordination, verbose logging

Update TestApp ContentView to list new demo categories in navigation.

Co-authored-by: Damian Markowski <DamianMarkowski@users.noreply.github.com>
Expand README to document all 8 instruments with detection categories:
- LeaksAnalyzer, ConcurrencyAnalyzer, AllocationsAnalyzer (existing)
- EnergyAnalyzer, NetworkAnalyzer, HangsAnalyzer (new)
- StartupAnalyzer, DiskIOAnalyzer (new)

Update repository layout, architecture section, TestApp purpose,
and typical workflow to reflect the expanded analysis capabilities.

Co-authored-by: Damian Markowski <DamianMarkowski@users.noreply.github.com>
@cursor
Copy link
Copy Markdown

cursor Bot commented Mar 3, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

StartupAnalyzer: Remove parentheses from SDK init search patterns
("configure(", "initialize(", etc.) since Mach-O symbol names don't
contain parentheses. This allows the patterns to match symbols like
_Firebase_configure correctly.

DiskIOAnalyzer: Add "CoreData" to Core Data detection patterns so that
symbols like _CoreData_ref count as evidence, ensuring the threshold
is met for the batch size check.

Co-authored-by: Damian Markowski <DamianMarkowski@users.noreply.github.com>
@DamianMarkowski DamianMarkowski marked this pull request as ready for review March 3, 2026 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants