Skip to content

Instantly share code, notes, and snippets.

@vigneshshanmugam
Last active February 17, 2020 21:58
Show Gist options
  • Save vigneshshanmugam/af60b7d0374349491f4c939b35eb7d51 to your computer and use it in GitHub Desktop.
Save vigneshshanmugam/af60b7d0374349491f4c939b35eb7d51 to your computer and use it in GitHub Desktop.
JS Sampling Profiler
const profiler = await performance.profile({
categories: ["js"],
sampleInterval: 10
});
const trace = await profiler.stop();
// Example trace looks something like this
{
"frames": [
{
"column": 4,
"line": 2,
"name": "schedule",
"resourceId": 0
},
{
"column": 9,
"line": 1,
"name": "makeLongTask",
"resourceId": 0
}
],
"resources": [
"http://localhost:8080/index.html"
],
"samples": [
{
"stackId": 1,
"timestamp": 31.48999996483326
}
],
"stacks": [
{
"frameId": 1
},
{
"frameId": 1,
"parentId": 0
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment