forked from TritonDataCenter/node-stackvis
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c8cf4a1
commit 8a46f92
Showing
4 changed files
with
83 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,27 @@ | |||
/* | |||
* lib/output-collapsed.js: emits StackSets in collapsed format, compatible with | |||
* Brendan Gregg's FlameGraph tool. | |||
*/ | |||
|
|||
var mod_assert = require('assert'); | |||
|
|||
/* | |||
* Arguments: | |||
* | |||
* stacks StackSet Stacks to visualize | |||
* | |||
* output WritableStream Output file | |||
*/ | |||
exports.emit = function emitCollapsed(args, callback) | |||
{ | |||
mod_assert.ok(args.stacks && args.stacks.constructor && | |||
args.stacks.constructor.name == 'StackSet', | |||
'required "stacks" argument must be a StackSet'); | |||
mod_assert.ok(args.output && args.output.write && | |||
typeof (args.output.write) == 'function', | |||
'required "output" argument must be a function'); | |||
|
|||
args.stacks.eachStackByCount(function (frames, count) { | |||
process.stdout.write(frames.join(',') + ' ' + count + '\n'); | |||
}); | |||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters