Profiler: stop() method
JS Self-Profiling API
JS Self-Profiling API
The **`stop()`** method of the Profiler interface stops the profiler and returns a Promise which resolves to the profile itself.
## Syntax
```js-nolint
stop()
```
### Parameters
None.
### Return value
A Promise that resolves to an object containing the profile data. The format and interpretation of this object is described in [Profile anatomy and format](/docs/Web/API/JS_Self-Profiling_API/Profile_content_and_format).
## Examples
### Recording a profile
The following code profiles the `doWork()` operation, and logs the result.
```js
const profiler = new Profiler({ sampleInterval: 10, maxBufferSize: 10000 });
doWork();
const profile = await profiler.stop();
console.log(JSON.stringify(profile));
```
## Specifications
## Browser compatibility
Cite this
"Profiler: stop() method". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/API/Profiler/stop JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy