flamebearer
Advanced tools
Comparing version
13
index.js
@@ -41,12 +41,14 @@ 'use strict'; | ||
// given two strings (e.g. abc, abd), returns the common starting part (ab) | ||
function getSharedStringPart(str1, str2) { | ||
let shared = ''; | ||
let common = ''; | ||
const len = Math.min(str1.length, str2.length); | ||
for (let i = 0; i < len; i++) { | ||
if (str1[i] === str2[i]) shared += str1[i]; | ||
if (str1[i] === str2[i]) common += str1[i]; | ||
else break; | ||
} | ||
return shared; | ||
return common; | ||
} | ||
// converts V8 prof log (generated with --prof-process --preprocess flags) into call stacks | ||
function v8logToStacks(log) { | ||
@@ -99,2 +101,3 @@ const stacks = []; | ||
function mergeStacks(stacks) { | ||
// sort call stacks so that they can be merged top-down | ||
stacks.sort(compareStacks); | ||
@@ -105,2 +108,3 @@ | ||
// use a queue instead of recursion so that we don't hit max call stack limit | ||
while (queue.length) { | ||
@@ -120,2 +124,3 @@ const right = queue.pop(); | ||
// find the range of adjacent blocks with the same name on the current stack level | ||
const start = i; | ||
@@ -137,3 +142,3 @@ let hasChildren = false; | ||
// delta-encode bar positions | ||
// delta-encode bar positions for smaller output | ||
for (const level of levels) { | ||
@@ -140,0 +145,0 @@ let prev = 0; |
{ | ||
"name": "flamebearer", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "Blazing fast flame graphs for V8 and Node", | ||
@@ -18,4 +18,3 @@ "main": "index.js", | ||
"eslint": "^4.19.1", | ||
"eslint-config-mourner": "^2.0.3", | ||
"eslint-plugin-html": "^4.0.2" | ||
"eslint-config-mourner": "^2.0.3" | ||
}, | ||
@@ -26,9 +25,6 @@ "engines": { | ||
"scripts": { | ||
"test": "eslint index.js index.html bin/flamebearer" | ||
"test": "eslint index.js viz.js bin/flamebearer" | ||
}, | ||
"eslintConfig": { | ||
"extends": "mourner", | ||
"plugins": [ | ||
"html" | ||
] | ||
"extends": "mourner" | ||
}, | ||
@@ -35,0 +31,0 @@ "keywords": [ |
# 🔥 flamebearer | ||
_A work in progress._ | ||
Blazing fast [flame graph](http://www.brendangregg.com/flamegraphs.html) tool for Node and V8, | ||
used to visualize and explore performance profiling results. | ||
A blazing fast [flame graph](http://www.brendangregg.com/flamegraphs.html) tool for Node and V8. | ||
Used to visualize and explore performance profiling results. | ||
Designed to handle profiles of any size while remaining responsive and lightweight. | ||
@@ -16,3 +14,3 @@ | ||
```bash | ||
# install flamebearer | ||
# install flamebearer (Node v8.5+ required) | ||
$ npm install -g flamebearer | ||
@@ -30,3 +28,3 @@ | ||
- [Brendan Gregg](http://brendangregg.com/) for creating the [concept](https://queue.acm.org/detail.cfm?id=2927301) and maintaining the [reference implementation](http://brendangregg.com/flamegraphs.html). | ||
- [David Mark Clements](https://github.com/davidmarkclements) and [Matteo Collina](https://github.com/mcollina) for creating [0x](https://github.com/davidmarkclements/0x) which inspired this project. | ||
- [David Mark Clements](https://github.com/davidmarkclements) for creating [0x](https://github.com/davidmarkclements/0x) which inspired this project. | ||
- [Bernard Cornwell](http://www.bernardcornwell.net/books/) for the amazing books this project took its name from. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
2
-33.33%131
3.97%11439
-35.1%29
-6.45%