sigdump 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/ChangeLog +5 -0
  2. data/lib/sigdump.rb +12 -8
  3. data/lib/sigdump/setup.rb +1 -4
  4. metadata +2 -2
data/ChangeLog CHANGED
@@ -1,4 +1,9 @@
1
1
 
2
+ 2013-04-26 version 0.2.0:
3
+
4
+ * Renamed Sigdump.install_thread_dump_handler to Sigdump.setup
5
+ * Added Sigdump.dump
6
+
2
7
  2013-04-24 version 0.1.1:
3
8
 
4
9
  * Signal handler dumps GC statistics as well if GC::Profiler is enabled
@@ -1,20 +1,24 @@
1
1
  module Sigdump
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
 
4
- def self.install_thread_dump_handler(signal, path=nil)
4
+ def self.setup(signal=ENV['SIGDUMP_SIGNAL'] || 'SIGCONT', path=ENV['SIGDUMP_PATH'])
5
5
  Kernel.trap(signal) do
6
6
  begin
7
- _open_dump_path(path) do |io|
8
- io.write "Sigdump at #{Time.now} process #{Process.pid} (#{$0})\n"
9
- dump_all_thread_backtrace(io)
10
- dump_object_count(io)
11
- dump_gc_profiler_result(io)
12
- end
7
+ dump(path)
13
8
  rescue
14
9
  end
15
10
  end
16
11
  end
17
12
 
13
+ def self.dump(path=ENV['SIGDUMP_PATH'])
14
+ _open_dump_path(path) do |io|
15
+ io.write "Sigdump at #{Time.now} process #{Process.pid} (#{$0})\n"
16
+ dump_all_thread_backtrace(io)
17
+ dump_object_count(io)
18
+ dump_gc_profiler_result(io)
19
+ end
20
+ end
21
+
18
22
  def self.dump_all_thread_backtrace(io)
19
23
  Thread.list.each do |thread|
20
24
  dump_backtrace(thread, io)
@@ -1,7 +1,4 @@
1
1
  require File.expand_path('../../sigdump', __FILE__)
2
2
 
3
- signal = ENV['SIGDUMP_SIGNAL'] || 'SIGCONT'
4
- path = ENV['SIGDUMP_PATH'] || ''
5
-
6
- Sigdump.install_thread_dump_handler(signal, path)
3
+ Sigdump.setup(signal, path)
7
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sigdump
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-24 00:00:00.000000000 Z
12
+ date: 2013-04-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake