sampling_prof 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sampling_prof.jar +0 -0
- data/lib/sampling_prof.rb +9 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e7a1a5ad44d119d950751f2891a63d419d3115c
|
4
|
+
data.tar.gz: 38c2170c7a50c97235da5f113e9a8804593397fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 09c2f8ce855135db3beef3198cdc282cafe6f9f97f0b69a711df2580427f8cc1d2bde6fe79a2f9bd7104bea0ee82c79b9ed4312ff8bfb7106219088efa6b4f1c
|
7
|
+
data.tar.gz: 9cbac609d97de9bb73c3b7f0f2c91f2fb1953c9999c996ef18c551039e5e9c91a11da0147fc483982cb1b9a6e433c60ff8af6914729a4443b8c01589ac28dae8
|
data/lib/sampling_prof.jar
CHANGED
Binary file
|
data/lib/sampling_prof.rb
CHANGED
@@ -31,7 +31,7 @@ class SamplingProf
|
|
31
31
|
f.puts ""
|
32
32
|
counts.each do |count|
|
33
33
|
# node id, count
|
34
|
-
f.puts count.join(",")
|
34
|
+
f.puts count.flatten.join(",")
|
35
35
|
end
|
36
36
|
f.puts ""
|
37
37
|
call_graph.each do |v|
|
@@ -53,19 +53,21 @@ class SamplingProf
|
|
53
53
|
counts = counts.split("\n").map do |l|
|
54
54
|
l.split(',').map(&:to_i)
|
55
55
|
end
|
56
|
-
|
56
|
+
total_samples, report = flat_report(nodes, counts)
|
57
57
|
|
58
|
-
output.puts "total
|
59
|
-
output.puts "
|
58
|
+
output.puts "total samples: #{total_samples}"
|
59
|
+
output.puts "self\t%\ttotal\t%\tname"
|
60
60
|
report.first(20).each do |v|
|
61
61
|
output.puts v.join("\t")
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
65
|
def flat_report(nodes, counts)
|
66
|
-
total = counts.map{|_,
|
67
|
-
reports = counts.sort_by{|_,
|
68
|
-
[
|
66
|
+
total = counts.map{|_,sc,tc| sc}.reduce(:+)
|
67
|
+
reports = counts.reject{|_,sc,tc| sc == 0}.sort_by{|_,sc,tc| -sc}.map do |id, sc, tc|
|
68
|
+
[sc, '%.2f%' % (100 * sc.to_f/total),
|
69
|
+
tc, '%.2f%' % (100 * tc.to_f/total),
|
70
|
+
nodes[id]]
|
69
71
|
end
|
70
72
|
[total, reports]
|
71
73
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sampling_prof
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Xiao Li
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2014-02-
|
12
|
+
date: 2014-02-09 00:00:00 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake-compiler
|