get_process_mem_pss_fixed 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,41 @@
1
+ Name: bash
2
+ State: S (sleeping)
3
+ Tgid: 3
4
+ Ngid: 0
5
+ Pid: 3
6
+ PPid: 1
7
+ TracerPid: 0
8
+ Uid: 58790 58790 58790 58790
9
+ Gid: 58790 58790 58790 58790
10
+ FDSize: 256
11
+ Groups:
12
+ VmPeak: 109120 kB
13
+ VmSize: 109120 kB
14
+ VmLck: 0 kB
15
+ VmPin: 0 kB
16
+ VmHWM: 2032 kB
17
+ VmRSS: 2032 kB
18
+ VmData: 356 kB
19
+ VmStk: 136 kB
20
+ VmExe: 956 kB
21
+ VmLib: 2288 kB
22
+ VmPTE: 64 kB
23
+ VmSwap: 0 kB
24
+ Threads: 1
25
+ SigQ: 0/274188
26
+ SigPnd: 0000000000000000
27
+ ShdPnd: 0000000000000000
28
+ SigBlk: 0000000000010000
29
+ SigIgn: 0000000000380004
30
+ SigCgt: 000000004b817efb
31
+ CapInh: 0000000000000000
32
+ CapPrm: 0000000000000000
33
+ CapEff: 0000000000000000
34
+ CapBnd: 0000001ff598cffe
35
+ Seccomp: 2
36
+ Cpus_allowed: f
37
+ Cpus_allowed_list: 0-3
38
+ Mems_allowed: 00000000,00000001
39
+ Mems_allowed_list: 0
40
+ voluntary_ctxt_switches: 34
41
+ nonvoluntary_ctxt_switches: 35
@@ -0,0 +1,52 @@
1
+ require 'test_helper'
2
+
3
+ class GetProcessMemTest < Test::Unit::TestCase
4
+
5
+ def setup
6
+ @mem = GetProcessMem.new
7
+ end
8
+
9
+ def test_seems_to_work
10
+ assert @mem.kb > 0
11
+ assert @mem.mb > 0
12
+ assert @mem.gb > 0
13
+ assert @mem.bytes > 0
14
+ end
15
+
16
+ def test_linux_smap
17
+ delta = 1
18
+ bytes = @mem.linux_memory(fixture_path("heroku-bash-smap"))
19
+ assert_in_delta BigDecimal.new("2122240.0"), bytes, delta
20
+ end
21
+
22
+ def test_linux_status
23
+ bytes = @mem.linux_status_memory(fixture_path("heroku-bash-status"))
24
+ assert_equal bytes, 2080768
25
+ end
26
+
27
+ def test_conversions
28
+ bytes = 0
29
+ delta = BigDecimal.new("0.0000001")
30
+ assert_in_delta 0.0, @mem.kb(bytes), delta
31
+ assert_in_delta 0.0, @mem.mb(bytes), delta
32
+ assert_in_delta 0.0, @mem.gb(bytes), delta
33
+
34
+ # kb
35
+ bytes = 1024
36
+ assert_in_delta 1.0, @mem.kb(bytes), delta
37
+ assert_in_delta 0.0009765625, @mem.mb(bytes), delta
38
+ assert_in_delta 9.5367431640625e-07, @mem.gb(bytes), delta
39
+
40
+ # mb
41
+ bytes = 1_048_576
42
+ assert_in_delta 1024.0, @mem.kb(bytes), delta
43
+ assert_in_delta 1.0, @mem.mb(bytes), delta
44
+ assert_in_delta 0.0009765625, @mem.gb(bytes), delta
45
+
46
+ # gb
47
+ bytes = 1_073_741_824
48
+ assert_in_delta 1048576.0, @mem.kb(bytes), delta
49
+ assert_in_delta 1024.0, @mem.mb(bytes), delta
50
+ assert_in_delta 1.0, @mem.gb(bytes), delta
51
+ end
52
+ end
@@ -0,0 +1,10 @@
1
+ Bundler.require
2
+
3
+ require 'get_process_mem'
4
+ require 'test/unit'
5
+
6
+ def fixture_path(name = nil)
7
+ path = Pathname.new(File.expand_path("../fixtures", __FILE__))
8
+ return path.join(name) if name
9
+ path
10
+ end
metadata ADDED
@@ -0,0 +1,104 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: get_process_mem_pss_fixed
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.2
5
+ platform: ruby
6
+ authors:
7
+ - Richard Schneeman
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-05-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sys-proctable
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
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.1'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: test-unit
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 3.1.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 3.1.0
55
+ description: " Get memory usage of a process in Ruby "
56
+ email:
57
+ - richard.schneeman+rubygems@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".travis.yml"
64
+ - CHANGELOG.md
65
+ - Gemfile
66
+ - README.md
67
+ - Rakefile
68
+ - appveyor.yml
69
+ - get_process_mem.gemspec
70
+ - lib/get_process_mem/version.rb
71
+ - lib/get_process_mem_pss_fixed.rb
72
+ - test/fixtures/heroku-bash-smap
73
+ - test/fixtures/heroku-bash-status
74
+ - test/get_process_mem_test.rb
75
+ - test/test_helper.rb
76
+ homepage: https://github.com/vfreefly/get_process_mem
77
+ licenses:
78
+ - MIT
79
+ metadata: {}
80
+ post_install_message:
81
+ rdoc_options: []
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ requirements: []
95
+ rubyforge_project:
96
+ rubygems_version: 2.7.3
97
+ signing_key:
98
+ specification_version: 4
99
+ summary: Use GetProcessMem to find out the amount of RAM used by any process
100
+ test_files:
101
+ - test/fixtures/heroku-bash-smap
102
+ - test/fixtures/heroku-bash-status
103
+ - test/get_process_mem_test.rb
104
+ - test/test_helper.rb