heap-profiler 0.6.0 → 0.7.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
  SHA256:
3
- metadata.gz: d471a3cfa86394c637238b8d27fb487b764862a45ef016e6de9570e9b90811ab
4
- data.tar.gz: 05d056160722162d9e6a2866e69baba73a8eb9bc4237e0d1fc597573c15b2380
3
+ metadata.gz: aca11eaccc68d8f62bd6ca0150f55ec43efa688ec9904682945b838c6b181afc
4
+ data.tar.gz: f46324b582fd4b4f840debd5efdf9418218d60e58ed84697848c4664b084523c
5
5
  SHA512:
6
- metadata.gz: a8d5cea4cc882c00170de66aae01216b52692b60af46a2d5be64804f5565a03016716d17bbe5e413f38dceebc9b7238abaf756b50d519236044dde2f2ae1925b
7
- data.tar.gz: 3031b322e69a2235ff388756adf89306e5dfa9cdad639bff79b122339e93b6c8b638cab8ff4f2b4c41592bfb62df05b0c32f8eb3c2a3d6c22f0963b1017cb9d0
6
+ metadata.gz: 825b314692a3a2f9673f5935fa66e42555ea35f9c72527e74fca906a32b90d24d6a7fc8247b5112b4c9d70baf03c3192938c770137833862380ed814f9863566
7
+ data.tar.gz: 2667a8bcdc9722114309a5136d58dbed32f06a964ed396940aebc7825a50b20f8fd85e8a73f4ae5103cb8e652b518db96101ccbe53cdf76147e3fffb02b52ad3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- heap-profiler (0.6.0)
4
+ heap-profiler (0.7.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -19,6 +19,7 @@ module HeapProfiler
19
19
  @report_directory = report_directory
20
20
  @allocated = open_dump('allocated')
21
21
  @generation = Integer(File.read(File.join(report_directory, 'generation.info')))
22
+ @generation = nil if @generation == 0
22
23
  end
23
24
 
24
25
  def allocated_diff
@@ -35,9 +35,11 @@ module HeapProfiler
35
35
  @dir_path = dir_path
36
36
  @enable_tracing = !allocation_tracing_enabled?
37
37
  @generation = nil
38
+ @partial = true
38
39
  end
39
40
 
40
- def start
41
+ def start(partial: true)
42
+ @partial = partial
41
43
  FileUtils.mkdir_p(@dir_path)
42
44
  ObjectSpace.trace_object_allocations_start if @enable_tracing
43
45
 
@@ -46,7 +48,7 @@ module HeapProfiler
46
48
 
47
49
  HeapProfiler.name_anonymous_modules!
48
50
 
49
- 4.times { GC.start }
51
+ GC.start
50
52
  GC.disable
51
53
  @generation = GC.count
52
54
  end
@@ -60,11 +62,11 @@ module HeapProfiler
60
62
  dump_heap(@allocated_heap)
61
63
 
62
64
  GC.enable
63
- 4.times { GC.start }
64
- dump_heap(@retained_heap, partial: true)
65
+ GC.start
66
+ dump_heap(@retained_heap, partial: @partial)
65
67
  @allocated_heap.close
66
68
  @retained_heap.close
67
- write_info("generation", @generation.to_s)
69
+ write_info("generation", @partial ? @generation.to_s : "0")
68
70
  end
69
71
 
70
72
  def run
@@ -84,8 +84,10 @@ module HeapProfiler
84
84
  analyzer = Analyzer.new(heap, index)
85
85
  dimensions = analyzer.run(@metrics, @groupings)
86
86
 
87
- io.puts "Total: #{scale_bytes(dimensions['total'].memory)} " \
88
- "(#{dimensions['total'].objects} objects)"
87
+ if dimensions['total']
88
+ io.puts "Total: #{scale_bytes(dimensions['total'].memory)} " \
89
+ "(#{dimensions['total'].objects} objects)"
90
+ end
89
91
 
90
92
  @metrics.each do |metric|
91
93
  next unless GROUPED_METRICS.include?(metric)
@@ -13,10 +13,10 @@ module HeapProfiler
13
13
  class << self
14
14
  attr_accessor :current_reporter
15
15
 
16
- def start(dir)
16
+ def start(dir, **kwargs)
17
17
  return if current_reporter
18
18
  self.current_reporter = Reporter.new(dir)
19
- current_reporter.start
19
+ current_reporter.start(**kwargs)
20
20
  end
21
21
 
22
22
  def stop
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module HeapProfiler
3
- VERSION = "0.6.0"
3
+ VERSION = "0.7.0"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heap-profiler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean Boussier
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-15 00:00:00.000000000 Z
11
+ date: 2023-02-27 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Make several heap dumps and summarize allocated, retained memory
14
14
  email:
@@ -78,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
78
  - !ruby/object:Gem::Version
79
79
  version: '0'
80
80
  requirements: []
81
- rubygems_version: 3.3.7
81
+ rubygems_version: 3.4.6
82
82
  signing_key:
83
83
  specification_version: 4
84
84
  summary: Ruby heap profiling tool