> For the complete documentation index, see [llms.txt](https://nelson-9.gitbook.io/nelson/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nelson-9.gitbook.io/nelson/markdown/en/profiler/profile.md).

# profile

Profile execution time for Macro functions.

## 📝 Syntax

* profile on
* profile off
* profile resume
* profile clear
* status = profile('status')
* p = profile('info')
* profile('show', sortOption)
* profile('show', sortOption, nbLines)

## 📥 Input argument

* sortOption - a string: 'nfl' by name file line, 'line' by line, 'percalls', 'totaltime', 'filename', 'function' or 'nbcalls'.
* nbLines - a integer value: number of lines to display.

## 📄 Description

Profiling is a way to measure where Macro function spend times.

s = profile('status') returns a structure with the current status of the profiler.

p = profile('info') returns a structure with collected profiling data.

profile('on') starts profiler.

profile('off') stops profiler. Collected profiling data will be retrieved later withp = profile ('info').

profile('clear') clears collected profiling data.

profile('resume') restarts and continue and extends collected profiling data.

## 💡 Examples

```matlab
profile on
sind(5)
profile off
profile('show')
profile('show', 'totaltime')
profile('show', 'totaltime', 4)

```

```matlab
profile on
sind(5)
profile off
profsave(profile('info'), [tempdir(), 'profile_results'])
unix([tempdir(), 'profile_results/index.html'])

```

## 🔗 See also

[profsave](/nelson/markdown/en/profiler/profsave.md).

## 🕔 History

| Version | 📄 Description  |
| ------- | --------------- |
| 1.0.0   | initial version |
