garbageman 0.2.9 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Mzk3YTcxM2I0Mjk1Mjk4NjdmNjlmYzY1YzI2OTY4NzEwZGE1M2I4NA==
4
+ OWI5MGIyNWM4YzY5N2RkNzcyYjVjMWQ3NTJhYTg0YzAxYjJhNTVmMA==
5
5
  data.tar.gz: !binary |-
6
- ZjgyMDMwOTg3N2QyYzNmYjBjNmRiNmVjY2M0NmZmMDAwYzI3ZDFjMw==
6
+ M2Y5MjA0MTAzZWViOTg5YzMxZGQyMjAzNmQwYjgzNmE5NGU5MTA1Yg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MGI0OWUwOWMzZTdjYTVhMjZjYTEwMWUxODUyZmFhZWJmYzdhNjk0MzhhZTVl
10
- YWI2YjdhODUxMjkxOWFkZjk2Nzk2OTVhMzQ4ZDk4NjdjNDllZGMxYTViYjQ2
11
- MjE2ZjUyMGVhMjBiNThhYjkyN2Q5ZDBmZTEyYjljMGQ2YmM4NTI=
9
+ YmQ0MmIzMGMyYTcwZDA2ZTYyNGQyYWE2MWZkMWM5YTExZGU0YTk1YjM5MmEy
10
+ MWJmMDJjZDNiMzM1ZjhmODZjOGY0MTFmYzNkMDk4MzBiZWRkMDM2N2ZhNDgy
11
+ ZWY3YTAzYzc4MTE5OTQ4YmI4YmRiOTEyMGIwZDhjM2MyOGU5NDI=
12
12
  data.tar.gz: !binary |-
13
- NTQ2NjQ1MTNlNGFjOTgyZDYyMTBlYTQyMjk1ZTNkMzAyNDg1MmRiYmRjZWIx
14
- MGFhMjE1ZTMyNzI3ZDFmYmI3N2FkY2MyYzAyMGIxMGFjZWJlNDM2ZTgzNDU4
15
- MzlmM2YzMzYyNWIxYzFkYTkyY2QxZDRjNjI1MWE2ZjI5MmMxMDM=
13
+ M2IwZjMzMzkzZWMyNDNhODY2ZjVjOTEzNWY5MDVjYzFhODdhMjMwMWVlZjVh
14
+ OTVhZjJhNWFmZjZmNDIyYTViNmQzYjQ4YzIwN2E0NzJhZmQ2YTEwNTljMDhh
15
+ ODRjNWZhMjZhNTVkYjRhMjBjZjA5MjcyNDA4NTkwY2YzZTdlZjY=
data/garbageman.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: garbageman 0.2.8 ruby lib
5
+ # stub: garbageman 0.3.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "garbageman"
9
- s.version = "0.2.9"
9
+ s.version = "0.3.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
@@ -91,12 +91,13 @@ module GarbageMan
91
91
 
92
92
  write_gc_yaml server_index, STARTING
93
93
  debug "starting gc"
94
+ memory_used = @show_gc_times ? process_resident_memory_size_in_kb : 0
94
95
  starts = Time.now
95
96
  GC.enable
96
97
  Config.gc_starts.times { GC.start; sleep Config.gc_sleep }
97
98
  @last_gc_finished_at = Time.now
98
99
  diff = (@last_gc_finished_at - starts) * 1000
99
- info "GC took #{'%.2f' % diff}ms for #{@request_count} requests" if @show_gc_times
100
+ info "GC took #{'%.2f' % diff}ms for #{@request_count} requests, and freed #{memory_used - process_resident_memory_size_in_kb}kb of memory" if @show_gc_times
100
101
  write_gc_yaml server_index, NEXT_SERVER
101
102
 
102
103
  after_gc_callbacks.each(&:call)
@@ -112,6 +113,14 @@ module GarbageMan
112
113
  end
113
114
  end
114
115
 
116
+ def process_resident_memory_size_in_kb
117
+ headers, stats = `ps v #{Process.pid}`.split "\n"
118
+ return 0 unless headers && stats
119
+ headers = headers.strip.gsub(/ +/, ' ').split(' ')
120
+ stats = stats.strip.gsub(/ +/, ' ').split(' ')
121
+ Hash[headers.zip(stats)]['RSS'].to_i
122
+ end
123
+
115
124
  def create_gc_yaml
116
125
  return unless server_index
117
126
  return if File.exists?(Config.gc_yaml_file) && ! current_server?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: garbageman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Doug Youch