# %trace

## Summary

Visualizes the execution path of the given operation.

## Description

This magic command renders an HTML-based visualization of a runtime execution path of the given operation using the QuantumSimulator.

#### Required parameters

• Q# operation or function name. This must be the first parameter, and must be a valid Q# operation or function name that has been defined either in the notebook or in a Q# file in the same folder.
• Arguments for the Q# operation or function must also be specified as key=value pairs.

#### Optional parameters

• --depth=<integer> (default=1): The depth at which to render operations along the execution path.

## Examples for %trace

### Example 1

Visualize the execution path of a Q# operation defined as operation MyOperation() : Result:

In []: %trace MyOperation
Out[]: <HTML visualization of the operation>


### Example 2

Visualize the execution path of a Q# operation defined as operation MyOperation(a : Int, b : Int) : Result:

In []: %trace MyOperation a=5 b=10
Out[]: <HTML visualization of the operation>


### Example 3

Visualize operations at depth 2 on the execution path of a Q# operation defined as operation MyOperation() : Result:

In []: %trace MyOperation --depth=2
Out[]: <HTML visualization of the operation>