flamegraph 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG +5 -0
- data/README.md +4 -1
- data/lib/flamegraph/flamegraph.html +21 -8
- data/lib/flamegraph/version.rb +1 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5807961a031d5616c761cf1abd8cb40d0fcdf96d
|
4
|
+
data.tar.gz: 37504cd3a7eb373b5c032e16a42a18d034f9bc37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 513d03cd56555fb3a7973dca00ad3b7da31fb1eb63fccaac257b4d4e644f6542b3cb327e24182f69b1f271936102d8cb3c48487ed18581ff7d9602bc224f9468
|
7
|
+
data.tar.gz: 8557a47733c0af654c35a7c099580f1d4643dd928d2d2ea8919276928bf07a070982fd1ce289f3acc04057dbe21dc719cb2d31ab2d5377c3f85f7e1621fa0e9e
|
data/CHANGELOG
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# Flamegraph
|
2
2
|
|
3
|
-
Flamegraph support for arbitrary Ruby apps
|
3
|
+
Flamegraph support for arbitrary Ruby apps.
|
4
|
+
|
5
|
+
Note, flamegraph support is built in to rack-mini-profiler, just require this gem and you should be good to go.
|
6
|
+
Type ?pp=flamegraph to create one for the current page.
|
4
7
|
|
5
8
|
## Installation
|
6
9
|
|
@@ -3,7 +3,10 @@
|
|
3
3
|
<head>
|
4
4
|
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
|
5
5
|
<script src="//cdnjs.cloudflare.com/ajax/libs/d3/3.0.8/d3.min.js"></script>
|
6
|
+
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/1.3.1/lodash.min.js"></script>
|
7
|
+
|
6
8
|
<meta charset=utf-8 />
|
9
|
+
|
7
10
|
<title>Flame Graph of Page</title>
|
8
11
|
<style>
|
9
12
|
.info {height: 40px;}
|
@@ -72,7 +75,7 @@ var guessGem = function(frame)
|
|
72
75
|
}
|
73
76
|
|
74
77
|
split = split[Math.max(split.length-2,0)].split('/');
|
75
|
-
return split[split.length-1];
|
78
|
+
return split[split.length-1].split(':')[0];
|
76
79
|
}
|
77
80
|
else
|
78
81
|
{
|
@@ -226,7 +229,7 @@ $.each(data, function(){
|
|
226
229
|
var stat = gemStats[gem];
|
227
230
|
|
228
231
|
if(!stat) {
|
229
|
-
gemStats[gem] = stat = {samples: [], frames: []};
|
232
|
+
gemStats[gem] = stat = {name: gem, samples: [], frames: []};
|
230
233
|
}
|
231
234
|
|
232
235
|
stat.frames.push(this.frame);
|
@@ -254,14 +257,23 @@ topFrame.exclusiveCount += 1;
|
|
254
257
|
lastFrame.topFrame = topFrame;
|
255
258
|
|
256
259
|
var totalGems = 0;
|
257
|
-
$.each(gemStats, function(){
|
260
|
+
$.each(gemStats, function(k,stat){
|
261
|
+
totalGems++;
|
262
|
+
stat.samples = stat.samples.getUnique();
|
263
|
+
});
|
258
264
|
|
259
265
|
|
266
|
+
var gemsSorted = _(gemStats).pairs()
|
267
|
+
.sortBy(function(item){
|
268
|
+
return -item[1].samples.length;
|
269
|
+
})
|
270
|
+
.map(function(item){return item[1]})
|
271
|
+
.value();
|
272
|
+
|
260
273
|
var currentIndex = 0;
|
261
|
-
|
274
|
+
_.each(gemsSorted, function(stat){
|
262
275
|
|
263
276
|
stat.color = rainbow(totalGems, currentIndex);
|
264
|
-
stat.samples = stat.samples.getUnique();
|
265
277
|
|
266
278
|
for(var x=0; x < stat.frames.length; x++) {
|
267
279
|
info[stat.frames[x]] = {nodes: [], samples: [], color: stat.color};
|
@@ -271,6 +283,7 @@ $.each(gemStats, function(k,stat){
|
|
271
283
|
});
|
272
284
|
|
273
285
|
|
286
|
+
|
274
287
|
// see: http://bl.ocks.org/mundhradevang/1387786
|
275
288
|
function fontSize(d,i) {
|
276
289
|
var size = yScale(1) / 3;
|
@@ -335,10 +348,10 @@ for (var r in info) {
|
|
335
348
|
|
336
349
|
|
337
350
|
// render the legend
|
338
|
-
|
351
|
+
_.each(gemsSorted, function(gem){
|
339
352
|
var node = $("<div></div>")
|
340
|
-
.css("background-color",
|
341
|
-
.text(
|
353
|
+
.css("background-color", gem.color)
|
354
|
+
.text(gem.name + " " + samplePercent(gem.samples.length)) ;
|
342
355
|
$('.legend').append(node);
|
343
356
|
});
|
344
357
|
|
data/lib/flamegraph/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flamegraph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Saffron
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fast_stack
|
@@ -150,4 +150,3 @@ test_files:
|
|
150
150
|
- test/test_helper.rb
|
151
151
|
- test/test_renderer.rb
|
152
152
|
- test/test_sampler.rb
|
153
|
-
has_rdoc:
|