Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: accept name as dest identifier #117

Merged
merged 1 commit into from
Mar 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ class ClinicHeapProfiler extends events.EventEmitter {
detectPort = false,
collectOnFailure = false,
debug = false,
dest = `.clinic/${process.pid}.clinic-heapprofile`
name,
dest = `.clinic/${name || process.pid}.clinic-heapprofiler`
} = settings

this.detectPort = !!detectPort
Expand Down
4 changes: 2 additions & 2 deletions src/visualizer/data-tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ class DataTree {
// Value of hidden frames is the sum of their visible children
return node.children
? node.children.reduce((acc, child) => {
return acc + this.getNodeValue(child)
}, 0)
return acc + this.getNodeValue(child)
}, 0)
: 0
}

Expand Down
4 changes: 2 additions & 2 deletions src/visualizer/flame-graph-frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ function renderStackFrame (globals, locals, rect) {
// For a narrow right-hand edge of a block of frames of the same code area...
const rightEdgeReducer = (thinFrameReducer === 1 || !previousSibling || (!!nextSibling && sameArea(nodeData, nextSibling.data)))
? thinFrameReducer
// ...fade as above, but based on the width of these same-area siblings, not just this node, so that
// something like [ someFunc ./file.js ][ f ./file.js ][][]||| gets a visible right hand edge
// ...fade as above, but based on the width of these same-area siblings, not just this node, so that
// something like [ someFunc ./file.js ][ f ./file.js ][][]||| gets a visible right hand edge
: Math.min(1, visibleSiblings.slice(0, indexPosition).reduce((acc, sibling) => acc + (sameArea(nodeData, sibling.data) ? (sibling.x1 - sibling.x0) * widthRatio : 0), 0) / (lineWidth * 2))

const alphaFull = this.ui.presentationMode ? 0.8 : 0.7
Expand Down
2 changes: 1 addition & 1 deletion test/basic.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ test('cmd - test collect - data exists, html generated', t => {

t.error(err)

t.match(filename, /[0-9]+\.clinic-heapprofile$/)
t.match(filename, /[0-9]+\.clinic-heapprofiler$/)

fs.unlink(filename, callback)
fs.unlink(filename + '.html', callback)
Expand Down
2 changes: 1 addition & 1 deletion test/cmd-collect-analysing.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ test('test collect - emits "analysing" event', t => {
function cleanup (err, filename) {
t.error(err)

t.match(filename, /[0-9]+\.clinic-heapprofile$/)
t.match(filename, /[0-9]+\.clinic-heapprofiler$/)

fs.unlink(filename, err => {
t.error(err)
Expand Down
2 changes: 1 addition & 1 deletion test/detect-port.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ test('cmd - collect - detect server port', t => {

t.error(err)

t.match(filename, /[0-9]+\.clinic-heapprofile$/)
t.match(filename, /[0-9]+\.clinic-heapprofiler$/)

fs.unlink(filename, callback)
fs.unlink(filename + '.html', callback)
Expand Down
2 changes: 1 addition & 1 deletion test/failure.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ test('cmd - test collect - works with nonzero exit code when collectOnFailure=tr
function cleanup (err, filename) {
t.error(err)

t.match(filename, /[0-9]+\.clinic-heapprofile$/)
t.match(filename, /[0-9]+\.clinic-heapprofiler$/)

fs.unlink(filename, err => {
t.error(err)
Expand Down