Socket
Socket
Sign inDemoInstall

0x

Package Overview
Dependencies
234
Maintainers
3
Versions
123
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.2.1 to 5.3.0

38

lib/cpu-profile-to-tree.js

@@ -24,4 +24,40 @@ 'use strict'

function id2IndexMap (nodes) {
const map = new Array(nodes.length + 1)
for (let i = 0; i < nodes.length; i++) {
const node = nodes[i]
map[node.id] = i
}
return map
}
function convertCpuProf (nodes, id2Index, id) {
const node = nodes[id2Index[id]]
const name = node.callFrame.functionName
const url = node.callFrame.url
const lineNumber = node.callFrame.lineNumber
const childrenLength = node.children ? node.children.length : 0
const converted = {
children: new Array(childrenLength),
name: `${name}${url ? ' ' + url : ''}${lineNumber > 0 ? `:${lineNumber}` : ''}`,
top: node.hitCount,
value: node.hitCount,
S: 0
}
if (name[0] === '(' && childrenLength === 0) {
// filter out (garbage collector) and (idle)
converted.top = 0
converted.value = 0
}
for (let i = 0; i < childrenLength; i++) {
converted.children[i] = convertCpuProf(nodes, id2Index, node.children[i])
converted.value += converted.children[i].value
}
return converted
}
function cpuProfileToTree (profile) {
const converted = convert(profile.head)
const converted = profile.head
? convert(profile.head)
: convertCpuProf(profile.nodes, id2IndexMap(profile.nodes), 1)
return {

@@ -28,0 +64,0 @@ merged: converted,

2

package.json
{
"name": "0x",
"version": "5.2.1",
"version": "5.3.0",
"description": "🔥 single-command flamegraph profiling 🔥",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc