Skip to main content

manage_profiler

Auto-generated from the Python tool registry. Do not hand-edit outside <!-- examples:start --><!-- examples:end --> blocks — the generator (tools/generate_docs_reference.py) will overwrite them.

Group: profiling  ·  Module: services.tools.manage_profiler

Maturity: stable (support status; independent of enabled state, readiness and permissions).

Description​

Unity Profiler session control, counter reads, memory snapshots, and Frame Debugger.

SESSION:

  • profiler_start: Enable profiler, optionally record to .raw file (log_file, enable_callstacks)
  • profiler_stop: Disable profiler, stop recording
  • profiler_status: Get enabled state, active areas, recording path
  • profiler_set_areas: Toggle ProfilerAreas on/off (areas dict)

COUNTERS:

  • get_frame_timing: Synchronous FrameTimingManager data with the optional fields available in this Editor
  • get_counters: Sample up to 256 counters in one category over one frame
  • get_object_memory: Memory size of a specific object by path

INDEPENDENT WINDOWS:

  • window_start: Bounded category/markers sampling with warmup and deadline; returns window_id
  • window_status/window_result/window_cancel: Inspect, read terminal statistics, or dispose a window Completed per-frame sums use native units; p95 is nearest-rank, missing is distinct from zero.

MEMORY SNAPSHOT (requires com.unity.memoryprofiler):

  • memory_take_snapshot: Capture memory snapshot to file
  • memory_list_snapshots: List .snap files in bounded pages; follow next_cursor. Order is filesystem-defined, and directory changes during traversal may affect results.
  • memory_compare_snapshots: Compare legacy file metadata

MEMORY ANALYSIS (native bytes are distinct from managed/retained size):

  • memory_aggregate: Bounded hierarchy/shared runtime-resource sums with object deduplication
  • memory_snapshot_reader_status: Installed Memory Profiler reader ABI and supported snapshot formats
  • memory_analyze_snapshots: Typed native-object count/byte/identity deltas. Check memory_snapshot_reader_status for installed reader compatibility.

FRAME DEBUGGER:

  • frame_debugger_enable: Turn on Frame Debugger, report event count
  • frame_debugger_disable: Turn off Frame Debugger
  • frame_debugger_get_events: Get draw call events (paged, best-effort via reflection)

Parameters​

NameTypeRequiredDescription
actionstryesThe profiler action to perform.
categorystr | None—Profiler category name for get_counters (e.g. Render, Scripts, Memory, Physics).
counterslist[str] | None—Optional counter names for get_counters. Omit to sample the category. If the selection exceeds 256 counters, request a smaller explicit selection.
object_pathstr | None—Scene hierarchy or asset path for get_object_memory.
log_filestr | None—Path to .raw file for profiler_start recording. Project-relative or absolute inside the project or Unity temporary cache directory.
enable_callstacksbool | None—Enable allocation callstacks for profiler_start.
areasdict[str, bool] | None—Dict of area name to bool for profiler_set_areas.
snapshot_pathstr | None—Output path for memory_take_snapshot. Project-relative or absolute inside the project or Unity temporary cache directory.
search_pathstr | None—Search directory for memory_list_snapshots. Project-relative or absolute inside the project or Unity temporary cache directory.
snapshot_limitint | None—Maximum snapshot rows per page (default 64); entry and response byte limits may return fewer.
snapshot_cursorstr | None—One-use next_cursor from memory_list_snapshots; omit search_path when continuing. Expires after two minutes.
snapshot_astr | None—First snapshot path for memory_compare_snapshots. Project-relative or absolute inside the project or Unity temporary cache directory.
snapshot_bstr | None—Second snapshot path for memory_compare_snapshots. Project-relative or absolute inside the project or Unity temporary cache directory.
page_sizeint | None—Page size for frame_debugger_get_events (default 50, clamped to 1..500).
cursorint | None—Cursor offset for frame_debugger_get_events (default 0, negative values treated as 0).
markerslist[str] | None—1–8 distinct exact marker/counter names for window_start.
frame_countint | None—Window measurement frame limit (default 60).
warmup_framesint | None—Excluded warmup frames (default 0).
timeout_secondsint | None—Observation budget: snapshot 1..86400 (default 300), sampling window 1..120 (default 30).
window_idstr | None—Session-scoped ID returned by window_start; required for status/result/cancel.
include_samplesbool | None—Include bounded completed samples in window result (default false).
targetslist[str] | None—Loaded GameObject session ID strings for memory_aggregate; duplicate roots deduplicate.
max_objectsint | None—Read work budget: at most 1000000 objects; aggregate default250000, snapshot default1000000.
include_referencesbool | None—Include declared shared runtime resources in memory_aggregate (default true).
include_objectsbool | None—Return bounded object rows for memory_aggregate (default false).
object_limitint | None—Maximum returned object rows per list (default128); totals remain separately scoped.
name_prefixstr | None—Exact ordinal native object-name prefix for memory_analyze_snapshots; omit for all within budget.
thresholdslist[ProfilerThreshold] | None—Optional exact-marker statistic limits and native units for window_result only.
unity_instancestr | int | None—Target Unity instance for this call: Name@hash or hash prefix; an integer selects only that exact port over stdio and is rejected over HTTP. Read mcpforunity://instances for available targets. Omit to use the legacy active selection or the sole available instance.

Returns​

A dict containing the Unity response. The exact shape depends on the action.

Examples​

Check whether the selected Editor is already profiling before requesting a new capture or changing the active Profiler areas.

MCP arguments
{
"action": "profiler_status"
}