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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: de9f6f4f7f21a996d3ecf1e922aa11fb43f8d2f2
4
- data.tar.gz: d4ddca1249128c70847bf9a48e32a2698b34f178
3
+ metadata.gz: 3e7a1a5ad44d119d950751f2891a63d419d3115c
4
+ data.tar.gz: 38c2170c7a50c97235da5f113e9a8804593397fa
5
5
  SHA512:
6
- metadata.gz: 134db8e55f4756f8fde632e248021677befa69be81ec14b677b44220639cde040acca92781b32fbc327d3e836adf843b0d27f0e5e158290eae58f701ca4c818c
7
- data.tar.gz: 43e57db9317d42ded4597ae974bd13671ae3c87bbfc766275c403d1eae06039a6473860f232049d6f09e1e72db04608f35f9a64bd5bda7a481932d0d9abce9a6
6
+ metadata.gz: 09c2f8ce855135db3beef3198cdc282cafe6f9f97f0b69a711df2580427f8cc1d2bde6fe79a2f9bd7104bea0ee82c79b9ed4312ff8bfb7106219088efa6b4f1c
7
+ data.tar.gz: 9cbac609d97de9bb73c3b7f0f2c91f2fb1953c9999c996ef18c551039e5e9c91a11da0147fc483982cb1b9a6e433c60ff8af6914729a4443b8c01589ac28dae8
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
- total_count, report = flat_report(nodes, counts)
56
+ total_samples, report = flat_report(nodes, counts)
57
57
 
58
- output.puts "total counts: #{total_count}"
59
- output.puts "calls\t%\tname"
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{|_,c| c}.reduce(:+)
67
- reports = counts.sort_by{|_,c| -c}.map do |id, c|
68
- [c, '%.2f%' % (100 * c.to_f/total), nodes[id]]
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.2
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-08 00:00:00 Z
12
+ date: 2014-02-09 00:00:00 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake-compiler