memory_monitor_client 0.0.1
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 +7 -0
- data/.gitignore +10 -0
- data/.ruby-version +1 -0
- data/Gemfile +9 -0
- data/README.md +34 -0
- data/Rakefile +2 -0
- data/lib/memory_monitor_client/version.rb +3 -0
- data/lib/memory_monitor_client.rb +35 -0
- data/memory_monitor_client.gemspec +30 -0
- metadata +80 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 36c3f866060f39dcd36b571fad270cd31fcc59cb
|
4
|
+
data.tar.gz: be7203880fa1ab1b51d4d4e72ac1c957dcedb33f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 19193fca08c26ccea684984c473816ea2af689628fa04b17446d7a052e1cde569b7f69b31d6a3e05c0a8c1f73882cd14401579816bddd43725d21add7e0c2af8
|
7
|
+
data.tar.gz: c3165f06235f513e93b5d2f08335618b9c6a3b30db3597394fbc501c5caa0ef8cac0253f0a71c6ca46ff631842dcf2585065d0557efb85f312f18a83ddc074f3
|
data/.gitignore
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.3.1
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# MemoryMonitorClient
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
Add this line to your application's Gemfile:
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
gem 'memory_monitor_client'
|
9
|
+
```
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install memory_monitor_client
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
```ruby
|
21
|
+
config = { host: '127.0.0.1', port: 5555, period: 1 }
|
22
|
+
MemoryMonitorClient.run(config)
|
23
|
+
```
|
24
|
+
|
25
|
+
## Development
|
26
|
+
|
27
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
28
|
+
|
29
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
30
|
+
|
31
|
+
## Contributing
|
32
|
+
|
33
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/coolelvis/memory_monitor_client.
|
34
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'memory_monitor_client/version'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module MemoryMonitorClient
|
5
|
+
|
6
|
+
def self.run(config)
|
7
|
+
Thread.new do
|
8
|
+
socket = UDPSocket.new
|
9
|
+
socket.connect(config[:host], config[:port])
|
10
|
+
|
11
|
+
loop do
|
12
|
+
socket.send(JSON.dump(collect_data), 0)
|
13
|
+
sleep config[:period]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.collect_data
|
19
|
+
{
|
20
|
+
time_stamp: Time.now,
|
21
|
+
rss: rss,
|
22
|
+
gc_stat: gc_stat,
|
23
|
+
pid: Process.pid
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.rss
|
28
|
+
`ps -o rss #{Process.pid}`.split("\n").last.to_i / 1000
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.gc_stat
|
32
|
+
GC.stat
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'memory_monitor_client/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'memory_monitor_client'
|
8
|
+
spec.version = MemoryMonitorClient::VERSION
|
9
|
+
spec.authors = ['CoolElvis']
|
10
|
+
spec.email = ['elvisplus2@gmail.com']
|
11
|
+
|
12
|
+
spec.summary = %q{ Simple memory && GC monitor for ruby app. }
|
13
|
+
spec.description = %q{ Simple memory && GC monitor for ruby app. }
|
14
|
+
spec.homepage = 'https://github.com/CoolElvis/memory_monitor_client'
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
17
|
+
# delete this section to allow pushing this gem to any host.
|
18
|
+
if spec.respond_to?(:metadata) then
|
19
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
20
|
+
else
|
21
|
+
raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.'
|
22
|
+
end
|
23
|
+
|
24
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
26
|
+
spec.require_paths = ['lib']
|
27
|
+
|
28
|
+
spec.add_development_dependency 'bundler', '~> 1.11'
|
29
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: memory_monitor_client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- CoolElvis
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-07-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.11'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.11'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: " Simple memory && GC monitor for ruby app. "
|
42
|
+
email:
|
43
|
+
- elvisplus2@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- ".ruby-version"
|
50
|
+
- Gemfile
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- lib/memory_monitor_client.rb
|
54
|
+
- lib/memory_monitor_client/version.rb
|
55
|
+
- memory_monitor_client.gemspec
|
56
|
+
homepage: https://github.com/CoolElvis/memory_monitor_client
|
57
|
+
licenses: []
|
58
|
+
metadata:
|
59
|
+
allowed_push_host: https://rubygems.org
|
60
|
+
post_install_message:
|
61
|
+
rdoc_options: []
|
62
|
+
require_paths:
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
requirements: []
|
75
|
+
rubyforge_project:
|
76
|
+
rubygems_version: 2.5.1
|
77
|
+
signing_key:
|
78
|
+
specification_version: 4
|
79
|
+
summary: Simple memory && GC monitor for ruby app.
|
80
|
+
test_files: []
|