Show whether profiling is currently enabled and the captured frame range.
(
ctx: typer.Context,
json_flag: Annotated[
bool,
typer.Option("--json", help="Output as JSON"),
] = False,
)
| 32 | |
| 33 | @profiler_app.command("status") |
| 34 | def profiler_status( |
| 35 | ctx: typer.Context, |
| 36 | json_flag: Annotated[ |
| 37 | bool, |
| 38 | typer.Option("--json", help="Output as JSON"), |
| 39 | ] = False, |
| 40 | ) -> None: |
| 41 | """Show whether profiling is currently enabled and the captured frame range.""" |
| 42 | context: CLIContext = ctx.obj |
| 43 | try: |
| 44 | result = context.client.profiler.status() |
| 45 | if _should_json(context, json_flag): |
| 46 | print_json(result) |
| 47 | else: |
| 48 | enabled = result.get("enabled", False) |
| 49 | status_text = "[green]running[/green]" if enabled else "[dim]stopped[/dim]" |
| 50 | print_line(f"Profiler: {status_text}") |
| 51 | print_line(f"Frame range: {result.get('firstFrameIndex', -1)} - {result.get('lastFrameIndex', -1)}") |
| 52 | except UnityCLIError as e: |
| 53 | _handle_error(e) |
| 54 | |
| 55 | |
| 56 | @profiler_app.command("start") |
nothing calls this directly
no test coverage detected