cellumon 0.1.0 → 0.3.0
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 +4 -4
- data/cellumon.gemspec +2 -2
- data/lib/cellumon.rb +23 -12
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 393429643d51ab62509e289d26e26b6ff9525392
|
4
|
+
data.tar.gz: 317bf1a9f1481c17ff687e0d3fabb08e6e3a2776
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e46df51abd66e48a5835ab8af203edf580f9a82a93f0bc857bc341dc113d24f21119aa942a76aa29510eb3ddb0e75f8a6dd585345674e7d42fce354e0bbf216
|
7
|
+
data.tar.gz: 9703a1b0387a1a90ecf06175bdb691f2ddea703aa88aa22e02e54a655185283716224f8528f75e7b02bab76252fa0dcfe9128a79b5699597f32b37ffbdf1aef6
|
data/cellumon.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
4
|
gem.name = "cellumon"
|
5
|
-
gem.version = "0.
|
5
|
+
gem.version = "0.3.0"
|
6
6
|
gem.platform = Gem::Platform::RUBY
|
7
7
|
gem.summary = "Monitor threads, processes, and states of Celluloid and its Actor System."
|
8
8
|
gem.description = "Thread summary and reporting actor, utility for finding leaks and monitoring."
|
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
|
|
10
10
|
|
11
11
|
gem.authors = ["digitalextremist //"]
|
12
12
|
gem.email = ["code@extremist.digital"]
|
13
|
-
gem.homepage = "https://github.com/
|
13
|
+
gem.homepage = "https://github.com/abstractive/cellumon"
|
14
14
|
|
15
15
|
gem.required_ruby_version = ">= 1.9.2"
|
16
16
|
gem.required_rubygems_version = ">= 1.3.6"
|
data/lib/cellumon.rb
CHANGED
@@ -19,16 +19,21 @@ class Cellumon
|
|
19
19
|
memory_count: 13
|
20
20
|
}
|
21
21
|
|
22
|
-
def initialize
|
22
|
+
def initialize(mark=false)
|
23
23
|
@semaphor = {}
|
24
24
|
@status = {}
|
25
25
|
@timers = {}
|
26
|
+
@mark = mark
|
26
27
|
@intervals = MONITORS.dup
|
27
28
|
end
|
28
29
|
|
30
|
+
def mark
|
31
|
+
@mark ? "Cellumon > " : ""
|
32
|
+
end
|
33
|
+
|
29
34
|
MONITORS.each { |m,i|
|
30
35
|
define_method(:"start_#{m}!") { |interval=nil|
|
31
|
-
async.
|
36
|
+
async.send(:"starting_#{m}")
|
32
37
|
}
|
33
38
|
define_method(:"starting_#{m}") { |interval=nil|
|
34
39
|
@intervals[m] = interval || MONITORS[m]
|
@@ -46,12 +51,20 @@ class Cellumon
|
|
46
51
|
|
47
52
|
def memory_count!
|
48
53
|
if ready? :memory_count
|
49
|
-
|
54
|
+
total = `pmap #{Process.pid} | tail -1`[10,40].strip[0..-1]
|
55
|
+
console("Memory usage: #{memory(total)}")
|
50
56
|
ready! :memory_count
|
51
57
|
end
|
52
58
|
@timers[:memory_count] = after(@intervals[:memory_count]) { memory_count! }
|
53
59
|
end
|
54
60
|
|
61
|
+
def memory(total)
|
62
|
+
total = total.to_i
|
63
|
+
gb = (total / (1024 * 1024)).to_i
|
64
|
+
mb = total % gb
|
65
|
+
"#{'%0.2f' % "#{gb}.#{mb}"}gb" #de Very fuzzy math but fine for now.
|
66
|
+
end
|
67
|
+
|
55
68
|
def thread_survey!
|
56
69
|
if ready? :thread_survey
|
57
70
|
Celluloid.stack_summary
|
@@ -71,21 +84,19 @@ class Cellumon
|
|
71
84
|
def thread_report!
|
72
85
|
if ready? :thread_report
|
73
86
|
threads = Thread.list.inject({}) { |l,t| l[t.object_id] = t.status; l }
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
console "Threads #{threads.count}
|
80
|
-
"Running (#{running}) Sleeping (#{sleeping}) Aborting (#{aborting}); " +
|
81
|
-
"Terminated: Normally (#{normally_terminated}) Exception (#{exception_terminated})"
|
87
|
+
r = threads.select { |id,status| status == 'run' }.count
|
88
|
+
s = threads.select { |id,status| status == 'sleep' }.count
|
89
|
+
a = threads.select { |id,status| status == 'aborting' }.count
|
90
|
+
nt = threads.select { |id,status| status === false }.count
|
91
|
+
te = threads.select { |id,status| status.nil? }.count
|
92
|
+
console "Threads #{threads.count}: #{r}r #{s}s #{a}a #{nt}nt #{te}te"
|
82
93
|
ready! :thread_report
|
83
94
|
end
|
84
95
|
@timers[:thread_report] = after(@intervals[:thread_report]) { thread_report! }
|
85
96
|
end
|
86
97
|
|
87
98
|
def console(message)
|
88
|
-
puts "*, [#{Time.now.strftime('%FT%T.%L')}]
|
99
|
+
puts "*, [#{Time.now.strftime('%FT%T.%L')}] #{mark}#{message}"
|
89
100
|
end
|
90
101
|
|
91
102
|
private
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cellumon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- digitalextremist //
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Thread summary and reporting actor, utility for finding leaks and monitoring.
|
14
14
|
email:
|
@@ -23,7 +23,7 @@ files:
|
|
23
23
|
- Rakefile
|
24
24
|
- cellumon.gemspec
|
25
25
|
- lib/cellumon.rb
|
26
|
-
homepage: https://github.com/
|
26
|
+
homepage: https://github.com/abstractive/cellumon
|
27
27
|
licenses:
|
28
28
|
- MIT
|
29
29
|
metadata: {}
|