puma-status 0.1.1 → 0.1.2

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/core.rb +6 -3
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f4d3a61f4e72ae148d8debe88a983ecd0bf7d2953ef06a029c786bb99cd67172
4
- data.tar.gz: 837e34c18531eba9841013afa5d2dd9894f8055df821e994a297e1193c40b3b0
3
+ metadata.gz: 9a3510db7ca511e5f6a661691bc2126aa17de54ceedbaa9dc308c2d7e215c6bd
4
+ data.tar.gz: 1a3e97ac2ac36cf2fdfb1113aa961523e9912be90842dd9e534689e489718536
5
5
  SHA512:
6
- metadata.gz: a555eee336a295db126fcffbbbd84af8a86fedcfe9b430bd778acd69e6395780bddeb784360b338569ec1d36b12af87531253031fd86bc5acdd882be37433fba
7
- data.tar.gz: ed76d770e77983c41ddb0c9e300b1f96c5681e1e66ed36e830f8f7257447ea78c5dfdbf9f0de9ce5d8d3ea5ac20306d6fb48b3e7785c6107bc479580d9d6e4a4
6
+ metadata.gz: 2a63842da6fb0657826c7caba586a018f56983865999e4c9576af6f2d02a965367091450086f27a6e52bfdb07e2409dbd7723be3b384e7899cf3cc714607f63f
7
+ data.tar.gz: 027417e5cd61121b0b1293caeeee0332d2f269fbc33a386566832963e1e53be1939a42c7815bdf56711210cef466b30bd0bd45c1b3713bc6d3a43107afc0ff4d
data/lib/core.rb CHANGED
@@ -18,9 +18,12 @@ def get_stats(state_file_path)
18
18
  end
19
19
 
20
20
  def get_top_stats(pids)
21
- top_result = `top -b -n 1 -p #{pids.join(',')} | tail -n #{pids.length}`
22
- top_stats = top_result.split("\n").map { |row| r = row.split(' '); [r[0].to_i, r[5].to_i/1024, r[8].to_f] }
23
- .reduce({}) { |hash, row| hash[row[0]] = { mem: row[1], pcpu: row[2] }; hash }
21
+ pids.each_slice(19).inject({}) do |res, pids19|
22
+ top_result = `top -b -n 1 -p #{pids19.join(',')} | tail -n #{pids19.length}`
23
+ top_result.split("\n").map { |row| r = row.split(' '); [r[0].to_i, r[5].to_i/1024, r[8].to_f] }
24
+ .inject(res) { |hash, row| hash[row[0]] = { mem: row[1], pcpu: row[2] }; hash }
25
+ res
26
+ end
24
27
  end
25
28
 
26
29
  def hydrate_stats(stats, puma_state, state_file_path)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puma-status
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoann Lecuyer
@@ -93,7 +93,7 @@ files:
93
93
  - lib/helpers.rb
94
94
  - lib/puma-status.rb
95
95
  - lib/stats.rb
96
- homepage:
96
+ homepage: https://github.com/ylecuyer/puma-status
97
97
  licenses:
98
98
  - MIT
99
99
  metadata: {}
@@ -116,5 +116,5 @@ rubyforge_project:
116
116
  rubygems_version: 2.7.6.2
117
117
  signing_key:
118
118
  specification_version: 4
119
- summary: Display puma status of running puma server
119
+ summary: Command-line too for puma to display information about running request/process
120
120
  test_files: []