W3cubDocs

/Nushell

profile for debug

Profile each pipeline element in a closure.

Signature

> profile {flags} (closure)

Flags

  • --source, -: Collect source code in the report
  • --values, -: Collect values in the report
  • --max-depth, -d {int}: How many levels of blocks to step into (default: 1)

Parameters

  • closure: the closure to run

Input/output types:

input output
any table

Examples

Profile some code, stepping into the spam command and collecting source.

>defspam [] { "spam" };profile {|| spam|str length } -d2--source

Notes

The command collects run time of every pipeline element, recursively stepping into child closures until a maximum depth. Optionally, it also collects the source code and intermediate values.

Current known limitations are:

  • profiling data from subexpressions is not tracked
  • it does not step into loop iterations

Copyright © 2019–2023 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/profile.html