mmtop 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mmtop.rb +1 -0
- data/lib/mmtop/commands/basic.rb +2 -0
- data/lib/mmtop/pid.rb +35 -3
- data/lib/mmtop/process.rb +1 -1
- data/lib/mmtop/term_input.rb +3 -1
- data/lib/mmtop/term_printer.rb +4 -1
- data/lib/mmtop/version.rb +3 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 726bb7f95a803a865b5f6ecb0090e650853d603d
|
4
|
+
data.tar.gz: 0bddbf42784006cd7aa952cb36d26429ad2d793b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 877f83c90dcb8ed235a7a79b99ddfc07cf7eebc92690a01235bd0453e1454bbb11baecf0b1f8b4a1a9040b69428617ea3d7cff83813ecaa6b4d6b3120a0f5d58
|
7
|
+
data.tar.gz: 860d4f2bfd070d81f87a547c60e8b08343699718d329a60a1c32889b627b5d1a26b73d5b98c5f3f52144cab847b891a44a93c2c6cc2b5b55e107ed9259ba2f38
|
data/lib/mmtop.rb
CHANGED
data/lib/mmtop/commands/basic.rb
CHANGED
@@ -6,6 +6,8 @@ MMTop::Command.register do |c|
|
|
6
6
|
MMTop::Command.commands.sort_by(&:usage).each do |c|
|
7
7
|
puts "%-50s %s" % [c.usage, c.explain]
|
8
8
|
end
|
9
|
+
puts "%-50s %s" % ["[p]", "pause mmtop (how you got here)"]
|
10
|
+
puts "%-50s %s" % ["[enter]", "resume mmtop (how you leave here)"]
|
9
11
|
end
|
10
12
|
end
|
11
13
|
|
data/lib/mmtop/pid.rb
CHANGED
@@ -1,10 +1,42 @@
|
|
1
1
|
module MMTop
|
2
2
|
class PID
|
3
|
-
|
4
|
-
|
3
|
+
@iteration = 0
|
4
|
+
|
5
|
+
def self.pid_array
|
6
|
+
@pid_array ||= []
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.pid_hash
|
10
|
+
@pid_hash ||= {}
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.get(host, real_id)
|
14
|
+
key = [host, real_id]
|
15
|
+
|
16
|
+
pid = pid_hash[key]
|
17
|
+
if !pid
|
18
|
+
pid = pid_array.index(nil) || pid_array.size
|
19
|
+
end
|
20
|
+
|
21
|
+
pid_hash[key] = pid
|
22
|
+
pid_array[pid] = @iteration
|
23
|
+
pid
|
5
24
|
end
|
25
|
+
|
6
26
|
def self.reset
|
7
|
-
|
27
|
+
to_delete = pid_hash.map do |k, v|
|
28
|
+
# recycle pid after 2 loops
|
29
|
+
if pid_array[v] && pid_array[v] < @iteration - 1
|
30
|
+
k
|
31
|
+
end
|
32
|
+
end.compact
|
33
|
+
|
34
|
+
to_delete.each do |k|
|
35
|
+
idx = pid_hash.delete(k)
|
36
|
+
pid_array[idx] = nil
|
37
|
+
end
|
38
|
+
|
39
|
+
@iteration += 1
|
8
40
|
end
|
9
41
|
end
|
10
42
|
end
|
data/lib/mmtop/process.rb
CHANGED
data/lib/mmtop/term_input.rb
CHANGED
@@ -21,8 +21,10 @@ module MMTop
|
|
21
21
|
def control_mode(config)
|
22
22
|
raw(false)
|
23
23
|
while true
|
24
|
-
cmdline = Readline::readline('> ')
|
24
|
+
cmdline = Readline::readline('mmtop> ')
|
25
25
|
exit if cmdline.nil?
|
26
|
+
|
27
|
+
cmdline.strip!
|
26
28
|
Readline::HISTORY.push(cmdline)
|
27
29
|
return if cmdline.empty?
|
28
30
|
c = find_command(cmdline)
|
data/lib/mmtop/term_printer.rb
CHANGED
@@ -44,7 +44,10 @@ module MMTop
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def print_footer
|
47
|
-
|
47
|
+
footer_banner = (" mmtop version #{MMTop::VERSION} ".dark_gray) + "...".dark_gray + " press \"p\" to pause ".dark_gray
|
48
|
+
left_border_size = (@x - 2 - footer_banner.size) / 2
|
49
|
+
right_border_size = @x - 2 - footer_banner.size - left_border_size
|
50
|
+
puts corner + (edge * left_border_size) + footer_banner + (edge * right_border_size) + corner
|
48
51
|
end
|
49
52
|
|
50
53
|
def table_header_columns
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mmtop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Osheroff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mysql2
|
@@ -106,6 +106,7 @@ files:
|
|
106
106
|
- lib/mmtop/string_colorize.rb
|
107
107
|
- lib/mmtop/term_input.rb
|
108
108
|
- lib/mmtop/term_printer.rb
|
109
|
+
- lib/mmtop/version.rb
|
109
110
|
homepage: http://github.com/osheroff/mmtop
|
110
111
|
licenses: []
|
111
112
|
metadata: {}
|