sigdump 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +7 -0
  2. data/ChangeLog +4 -0
  3. data/README.md +46 -5
  4. data/lib/sigdump.rb +13 -1
  5. data/sigdump.gemspec +1 -0
  6. metadata +12 -16
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 20e16e2f6471680f7163393c866dce385f1f1d3f
4
+ data.tar.gz: 61638fe8baf560c431eb59751f072e1c992d0614
5
+ SHA512:
6
+ metadata.gz: c49d03384c0dd3410e38abb7b08f621689419adee7c365e01ef683ff94cdede5bb6f2fa87b5810da811db4282a57b79c54a71c56adf71b2ad05284fb76ffd0d2
7
+ data.tar.gz: d1eb8bd6df734dd9c24617ad01c192243c614c2b5cb9ed882eb64cf8363a1817962dee78420a23d6c0f98597891435db5eeee2f4236e1b2a447eb19bd1012f83
data/ChangeLog CHANGED
@@ -1,4 +1,8 @@
1
1
 
2
+ 2015-05-21 version 0.2.3:
3
+
4
+ * Signal handler shows GC.stat (by @sonots / Naotoshi Seo)
5
+
2
6
  2013-04-27 version 0.2.2:
3
7
 
4
8
  * Fixed SIGDUMP_PATH=- handling (by @yu74n / Yuta Hongo)
data/README.md CHANGED
@@ -1,26 +1,43 @@
1
1
  # sigdump
2
2
 
3
+ In short: *SIGQUIT of Java VM for Ruby.*
4
+
3
5
  Server applications (like Rails app) cause performance problems, deadlock or memory swapping from time to time. But it's painful to reproduce such kind of problems. If we can get information from a running process without restarting it, it's really helpful.
4
6
 
5
- `sigdump` gem installs a signal handler which dumps backtrace of running threads and number of allocated objects per class.
7
+ `sigdump` gem installs a signal handler which dumps backtrace of running threads, number of allocated objects per class, and GC statistics.
6
8
 
7
- If GC profiler is enabled (`GC::Profiler.enable` is called), it also dumps GC statistics.
9
+ If GC profiler is enabled (`GC::Profiler.enable` is called), it also dumps GC profiler reports.
8
10
 
9
11
  ## Install
10
12
 
11
13
  Just install one gem `sigdump` and require `sigdump/setup`:
12
14
 
13
- gem 'sigdump', :require => 'sigdump/setup'
15
+ ```ruby
16
+ gem 'sigdump', :require => 'sigdump/setup'
17
+ ```
18
+
19
+ ### Resque
20
+
21
+ Because Resque traps `SIGCONT`, you need to change the signal to another signal such as TSTP.
22
+ In environment.rb:
23
+
24
+ ```ruby
25
+ # setup sigdump: https://github.com/frsyuki/sigdump
26
+ ENV['SIGDUMP_SIGNAL'] = 'TSTP'
27
+ require 'sigdump/setup'
28
+ ```
14
29
 
15
30
  ## Usage
16
31
 
17
32
  Send `SIGCONT` signal to dump backtrace and heap status to `/tmp/sigdump-<pid>.log`:
18
33
 
19
- $ kill -CONT <pid>
34
+ ```shell
35
+ $ kill -CONT <pid>
36
+ ```
20
37
 
21
38
  Set `SIGDUMP_SIGNAL` environment variable to change the signal (default: SIGCONT).
22
39
 
23
- Set `SIGDUMP_PATH` environment variable to change the output path (default: /tmp/sigdump-\<pid\>.log). You can set "-" here to dump to STDOUT, "+" to dump to STDERR.
40
+ Set `SIGDUMP_PATH` environment variable to change the output path (default: /tmp/sigdump-\<pid\>.log). You can set "-" here to dump to STDOUT, or "+" to STDERR.
24
41
 
25
42
  ## Sample outout
26
43
 
@@ -43,6 +60,30 @@ Set `SIGDUMP_PATH` environment variable to change the output path (default: /tmp
43
60
  /srv/staging/current/vendor/bundle/ruby/1.9.1/gems/unicorn-4.3.1/bin/unicorn:121:in `<top (required)>'
44
61
  /srv/staging/current/vendor/bundle/ruby/1.9.1/bin/unicorn:23:in `load'
45
62
  /srv/staging/current/vendor/bundle/ruby/1.9.1/bin/unicorn:23:in `<main>'
63
+ GC stat:
64
+ count: 34
65
+ heap_allocated_pages: 1366
66
+ heap_sorted_length: 1368
67
+ heap_allocatable_pages: 0
68
+ heap_available_slots: 556777
69
+ heap_live_slots: 551708
70
+ heap_free_slots: 5069
71
+ heap_final_slots: 0
72
+ heap_marked_slots: 363350
73
+ heap_swept_slots: 58807
74
+ heap_eden_pages: 1366
75
+ heap_tomb_pages: 0
76
+ total_allocated_pages: 1367
77
+ total_freed_pages: 1
78
+ total_allocated_objects: 2438499
79
+ total_freed_objects: 1886791
80
+ malloc_increase_bytes: 650416
81
+ malloc_increase_bytes_limit: 16777216
82
+ minor_gc_count: 25
83
+ major_gc_count: 9
84
+ remembered_wb_unprotected_objects: 5122
85
+ remembered_wb_unprotected_objects_limit: 5222
86
+ old_objects: 348964
46
87
  Built-in objects:
47
88
  367,492: TOTAL
48
89
  208,193: T_STRING
@@ -1,5 +1,5 @@
1
1
  module Sigdump
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
 
4
4
  def self.setup(signal=ENV['SIGDUMP_SIGNAL'] || 'SIGCONT', path=ENV['SIGDUMP_PATH'])
5
5
  Kernel.trap(signal) do
@@ -14,6 +14,7 @@ module Sigdump
14
14
  _open_dump_path(path) do |io|
15
15
  io.write "Sigdump at #{Time.now} process #{Process.pid} (#{$0})\n"
16
16
  dump_all_thread_backtrace(io)
17
+ dump_gc_stat(io)
17
18
  dump_object_count(io)
18
19
  dump_gc_profiler_result(io)
19
20
  end
@@ -78,6 +79,17 @@ module Sigdump
78
79
  nil
79
80
  end
80
81
 
82
+ def self.dump_gc_stat(io)
83
+ io.write " GC stat:\n"
84
+
85
+ GC.stat.each do |key, val|
86
+ io.write " #{key}: #{val}\n"
87
+ end
88
+
89
+ io.flush
90
+ nil
91
+ end
92
+
81
93
  def self.dump_gc_profiler_result(io)
82
94
  return unless defined?(GC::Profiler) && GC::Profiler.enabled?
83
95
 
@@ -10,6 +10,7 @@ Gem::Specification.new do |gem|
10
10
  gem.version = Sigdump::VERSION
11
11
  gem.authors = ["Sadayuki Furuhashi"]
12
12
  gem.email = ["frsyuki@gmail.com"]
13
+ gem.license = "MIT"
13
14
  gem.has_rdoc = false
14
15
  gem.files = `git ls-files`.split("\n")
15
16
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
metadata CHANGED
@@ -1,30 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sigdump
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
5
- prerelease:
4
+ version: 0.2.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Sadayuki Furuhashi
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-04-28 00:00:00.000000000 Z
11
+ date: 2015-05-22 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rake
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: 0.9.2
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: 0.9.2
30
27
  description: Setup signal handler which dumps backtrace of running threads and number
@@ -35,7 +32,7 @@ executables: []
35
32
  extensions: []
36
33
  extra_rdoc_files: []
37
34
  files:
38
- - .gitignore
35
+ - ".gitignore"
39
36
  - ChangeLog
40
37
  - Gemfile
41
38
  - LICENSE
@@ -45,29 +42,28 @@ files:
45
42
  - lib/sigdump/setup.rb
46
43
  - sigdump.gemspec
47
44
  homepage: https://github.com/frsyuki/sigdump
48
- licenses: []
45
+ licenses:
46
+ - MIT
47
+ metadata: {}
49
48
  post_install_message:
50
49
  rdoc_options: []
51
50
  require_paths:
52
51
  - lib
53
52
  required_ruby_version: !ruby/object:Gem::Requirement
54
- none: false
55
53
  requirements:
56
- - - ! '>='
54
+ - - ">="
57
55
  - !ruby/object:Gem::Version
58
56
  version: '0'
59
57
  required_rubygems_version: !ruby/object:Gem::Requirement
60
- none: false
61
58
  requirements:
62
- - - ! '>='
59
+ - - ">="
63
60
  - !ruby/object:Gem::Version
64
61
  version: '0'
65
62
  requirements: []
66
63
  rubyforge_project:
67
- rubygems_version: 1.8.23
64
+ rubygems_version: 2.4.5
68
65
  signing_key:
69
- specification_version: 3
66
+ specification_version: 4
70
67
  summary: Setup signal handler which dumps backtrace of running threads and number
71
68
  of allocated objects per class. Require 'sigdump/setup', send SIGCONT, and see /tmp/sigdump-<pid>.log.
72
69
  test_files: []
73
- has_rdoc: false