Skip to main content
Glama

profile

Profile Python code to identify performance bottlenecks in CPU, memory, and GPU usage. Analyze scripts or code snippets for optimization insights.

Instructions

Profile Python code using Scalene.

Args: type: "script" (profile a file) or "code" (profile code snippet) script_path: Required if type="script". Path to Python script code: Required if type="code". Python code to execute cpu_only: Skip memory/GPU profiling include_memory: Profile memory allocations include_gpu: Profile GPU usage (requires NVIDIA GPU) reduced_profile: Show only lines >1% CPU or >100 allocations profile_only: Comma-separated paths to include (e.g., "myapp") profile_exclude: Comma-separated paths to exclude (e.g., "test,vendor") use_virtual_time: Measure CPU time excluding I/O wait cpu_percent_threshold: Minimum CPU % to report malloc_threshold: Minimum allocation bytes to report script_args: Command-line arguments for the script

Returns: {profile_id, summary, text_summary}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeYes
script_pathNo
codeNo
cpu_onlyNo
include_memoryNo
include_gpuNo
reduced_profileNo
profile_onlyNo
profile_excludeNo
use_virtual_timeNo
cpu_percent_thresholdNo
malloc_thresholdNo
script_argsNo

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ptmorris05/scalene-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server