Read SKILL.md first to understand instructions, heuristics, SQL queries, and expected outputs.
Ensure you have access to:
~/traces/app-heap.pb or a downloadable URL).Prompt: “Set up trace processor and prepare to analyze a heap dump.”
Verify:
trace_processor binary using:curl -LO https://get.perfetto.dev/trace_processor chmod +x trace_processor
trace_processor is installed and executable.Prompt: “Can you analyze a heap dump and find caching optimizations for our app?”
Verify:
Setup: Have a Perfetto Java heap dump URL ready (e.g., https://ui.perfetto.dev/#!/?s=0d259d2b6ef1e5e5970b83c47b5e531aff2d0fd9).
Prompt: “Analyze the heap dump at https://ui.perfetto.dev/#!/?s=0d259d2b6ef1e5e5970b83c47b5e531aff2d0fd9 to find caching opportunities. Focus on package ‘com.example.sampleapp’.”
Verify:
query_most_repeated_objects.sql and query_size_frequencies.sql using trace_processor.java.lang.* classes.com.example.sampleapp.Setup: Identify candidate classes from Test 3 (e.g., Owner: MediaItem, Owned: MediaMetadata).
Prompt: “I suspect that MediaMetadata objects are duplicated and owned by MediaItem. Can you verify if MediaItem owns MediaMetadata in the heap dump ‘/home/user/traces/app-heap.pb’?”
Verify:
query_heap_references.sql using trace_processor.<owner_classname> with MediaItem and <owned_classname> with MediaMetadata.Setup: Locate a target class file (e.g., MediaMetadata.java) and its referencing parent classes in the workspace.
Prompt: “We found a candidate class com.google.android.apps.photos.MediaMetadata which is repeated 15,000 times. The source code is in the workspace under src/com/google/android/apps/photos/MediaMetadata.java. Perform a deep analysis and present the findings.”
Verify:
MediaMetadata.java and its parent referencing files in the workspace.MediaMetadata is a good candidate.Prompt: “Create a detailed implementation plan for caching MediaMetadata in MediaItem. Include expected savings.”
Verify:
analysis.md or implementation_plan.md.Prompt: “I have reviewed the implementation plan. Please apply the caching changes to MediaMetadata.java and its references.”
Verify: