sidekiq-worker_stats 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a2dfa84049939f2b9e106c0c952210cc8ca4f775
4
- data.tar.gz: 5247578e6a5277f95954a64b002d8e1d9f13b4ab
3
+ metadata.gz: d8dbc164cd760d7aecfbcbe515060a03d1ab2b92
4
+ data.tar.gz: 8036d8280edfd1b3d76a1cb4cfa123c5c608c502
5
5
  SHA512:
6
- metadata.gz: 755fab1f88cbd2e373f706644e9b8f977fbec17804311ccf6f0baa9787feab1f81922392a8fd4fd1e78bc723f6d29a319da2b85494d588a7b4dce8ef9f7e53d3
7
- data.tar.gz: 0f513ff1b469ad9e7d948a6e79b0485e9b7dc78f6601a5d310505ece41982bd706c978a2c81a19821e481ef0f22f9d46aaefd838ec9153e0a3474fc524b95742
6
+ metadata.gz: 6efbfb46e988f9aea64afa3394a284ff739745a1a710456cb1d1ee603772301c1636f0bf4a9c48b77854c4719a1bec0ad842ad9ac7593f1d41540372449b15fb
7
+ data.tar.gz: 9f31680bd858585897625ed082e19efc14c1a53fe08a761bbc97aea4132d502ee6cc02a28cd7e69ca79fdf3a5ab74ddff222d7cccb01a4882f9537cdb4544b07
@@ -14,7 +14,6 @@ module Sidekiq
14
14
  attr_reader :stop_t
15
15
  attr_reader :walltime
16
16
  attr_reader :status
17
- attr_reader :page_size
18
17
  attr_reader :mem
19
18
 
20
19
  attr_reader :mem_thr
@@ -27,7 +26,6 @@ module Sidekiq
27
26
  @pid = ::Process.pid
28
27
  @jid = worker.jid
29
28
  @args = msg["args"]
30
- @page_size = `getconf PAGESIZE`.to_i
31
29
  start
32
30
  end
33
31
 
@@ -58,7 +56,6 @@ module Sidekiq
58
56
  stop: @stop_t,
59
57
  walltime: @walltime,
60
58
  status: @status,
61
- page_size: @page_size,
62
59
  mem: @mem
63
60
  }
64
61
 
@@ -83,7 +80,7 @@ module Sidekiq
83
80
  end
84
81
 
85
82
  def current_memory
86
- `awk '{ print $2 }' /proc/#{@pid}/statm`.strip.to_i * @page_size
83
+ `ps -o rss= -p #{@pid}`.strip.to_i * 1024
87
84
  end
88
85
 
89
86
  # Remove old samples if number of samples > @config.max_samples
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module WorkerStats
3
- VERSION = '0.0.7'.freeze
3
+ VERSION = '0.0.8'.freeze
4
4
  end
5
5
  end
@@ -1,6 +1,6 @@
1
1
  <div class="worker_stats">
2
2
  <h2>Worker Stats</h2>
3
- <h4>Showing results <%= "#{(@page * @per_page) + 1}" %> to <%= "#{[(@page + 1) * @per_page, @stats_length].min}" %> (Total: <%= "#{@stats_length}" %>)</h4>
3
+ <h4>Showing results <%= @stats_length == 0 ? "0" : "#{(@page * @per_page) + 1}" %> to <%= "#{[(@page + 1) * @per_page, @stats_length].min}" %> (Total: <%= "#{@stats_length}" %>)</h4>
4
4
  <br>
5
5
 
6
6
  <div style="height: 30px">
@@ -26,9 +26,8 @@
26
26
  <th>Started at</th>
27
27
  <th>Finished at</th>
28
28
  <th>Runtime (s)</th>
29
- <th>Start Memory</th>
30
- <th>Avg. Memory</th>
31
- <th>Peak Memory</th>
29
+ <th>Start Memory (Mb)</th>
30
+ <th>Peak Memory (Mb)</th>
32
31
  </thead>
33
32
 
34
33
  <tbody>
@@ -39,9 +38,8 @@
39
38
  <td><%= Time.at(worker["start"]).strftime "%Y-%m-%d %H:%M:%S" %></td>
40
39
  <td><%= Time.at(worker["stop"]).strftime "%Y-%m-%d %H:%M:%S" %></td>
41
40
  <td><%= "#{worker["walltime"].round(4)}" %></td>
42
- <td><%= "#{worker["mem"][worker["mem"].keys.min] / 1024 / 1024} Mb" %></td>
43
- <td><%= "#{(worker["mem"].values.inject(:+) / worker["mem"].count) / 1024 / 1024} Mb" %></td>
44
- <td><%= "#{(worker["mem"].values.max / 1024 / 1024)} Mb" %></td>
41
+ <td><%= "#{worker["mem"][worker["mem"].keys.min] / 1024 / 1024}" %></td>
42
+ <td><%= "#{(worker["mem"].values.max / 1024 / 1024)}" %></td>
45
43
  </tr>
46
44
  <% end %>
47
45
  </tbody>
@@ -54,15 +54,15 @@
54
54
  <div class="worker_stats__memory_table">
55
55
  <table class="table table-hover table-bordered table-striped table-white">
56
56
  <thead>
57
- <th>Time (after start)</th>
58
- <th>Memory</th>
57
+ <th>Time after start (s)</th>
58
+ <th>Memory (Mb)</th>
59
59
  </thead>
60
60
 
61
61
  <tbody>
62
62
  <% @worker["mem"].each do |time, mem| %>
63
63
  <tr>
64
- <td><%= (time.to_f - @worker["start"]).round(2).to_s %> seconds</td>
65
- <td><%= "#{mem / 1024 / 1024} Mb" %></td>
64
+ <td><%= (time.to_f - @worker["start"]).round(2).to_s %></td>
65
+ <td><%= "#{mem / 1024 / 1024}" %></td>
66
66
  </tr>
67
67
  <% end %>
68
68
  </tbody>
@@ -27,7 +27,7 @@ module Sidekiq
27
27
  @workers_stats = @workers_stats.sort_by { |k, v| ::Time.at(v["start"]) }.reverse
28
28
  @stats_length = @workers_stats.length
29
29
 
30
- @max_pages = @workers_stats.length / @per_page
30
+ @max_pages = (@stats_length / @per_page) - (@stats_length % @per_page == 0 ? 1 : 0)
31
31
  @page = @page * @per_page < @workers_stats.length ? @page : @max_pages
32
32
 
33
33
  down_limit = @page * @per_page
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-worker_stats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandre Jesus
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-30 00:00:00.000000000 Z
11
+ date: 2017-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq