Skip to content

Commit

Permalink
feat: accept name as dest identifier
Browse files Browse the repository at this point in the history
Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com>
  • Loading branch information
RafaelGSS committed Mar 15, 2023
1 parent f27605f commit 1a4653f
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 9 deletions.
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

0 comments on commit 1a4653f

Please sign in to comment.