sys-proctable 1.2.0 → 1.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 00ee6aa318ca856d8b83e26685289b1c3eae3817
4
- data.tar.gz: 4af42eeef3367f56b8c6ec9383393ba16900af3e
2
+ SHA256:
3
+ metadata.gz: 01c653a363b9c37b67d34370e882e24aefc772c95677ee7420b9601f279c2e9b
4
+ data.tar.gz: c3dbf4252b810a0abd69bdc3d401a653ae8b8e24d31d8be15fea7d5ddd37f7a3
5
5
  SHA512:
6
- metadata.gz: 7ce22a2caf51c2909024450fad56c15f3ca4d895524b70b6cc7584da8786055fb8a1b2c9b7fe80aadb88d18065d1470368c51d1b0dbb7ccbf34318ab2144d487
7
- data.tar.gz: d81c7f01727cf1521374410b9c473c82b6d5b04d92315d5e4427346c91eead836f43f70b46979e1df6f3eaa858a1677e95e2141bfae737cb75691aee507b77b3
6
+ metadata.gz: 9f97e3368e08424eb1ac80dd50865f0803066de539fd93defebfb8dbd8591d44447a24a5621555b2b6e29f5f72ae33f03be2b973d3106ad87ecd1bcef67fb8eb
7
+ data.tar.gz: a17fd29c3cfc2aed02ab884467aa24f403258aa8bc9f4f9fa084892685d6898992808625e3dacc18d1616232f11ad8c2b7ac8ce21b80fdd3bd8faadb4e733791
Binary file
data.tar.gz.sig CHANGED
@@ -1 +1,2 @@
1
- t����+�xe`��~kĂ��xU�y��@�&��o�}��_�����z-FX�w��^���c#-vNP���k-9��cSQ��l")�{L���n�׌���!�R�9���r�����{�3��J�� 7�Y�ˆ8ٲ�<�5�e�tq O�rۏ�y�A3j/��\�x����X`�m"�f�GZ���×�'w�ސ��|��{D�nw8R2���S0S�7��Spؼ�p)��ɴn�/��hь�ݨ�����6}�p_a�ͫ�s��кO��� �8���/��A��!����ι2��}�ޑA��=#X�=�A����v�Y�%?����2�ƥ�Z H�,���*m'sv4 ��Ģ��\�{((J�qC��ĥ��
1
+ \�Yffw`X 9zSǟ������B��2�+���oJ��h�߳��l�_x��"�0SP��V��?\Z5��̽C^�w{���\&\rql�=�K)�<�8f68s�?IB
2
+ TVȆ.Z��6����H�?*8�䮕@�~0Ȉ�����'|��V̂fw ��1�
@@ -1,6 +1,43 @@
1
+ == 1.2.5 - 19-Jun-2020
2
+ * Added the delayacct_blkio_ticks, guest_time, and cguest_time fields on Linux.
3
+ These require 2.6.18 or later, but will simply be nil on earlier versions.
4
+ * Added the rsslim synonym for the rlim field for Linux.
5
+
6
+ == 1.2.4 - 18-Jun-2020
7
+ * Added the num_threads field for Linux. This was originally a dead field in
8
+ older versions of Linux that was skipped, but as of Linux 2.6+ it actually
9
+ holds meaningful data.
10
+ * Updated the specs for Linux.
11
+
12
+ == 1.2.3 - 17-Mar-2020
13
+ * Properly include a copy of Apache-2.0 in LICENSE file as part of library.
14
+ * Add explicit .rdoc extensions to CHANGES and MANIFEST files.
15
+
16
+ == 1.2.2 - 12-Aug-2019
17
+ * Added compatibility for JRuby on Mac which apparently doesn't define a
18
+ read_uint64 method, nor a CharArray. Thanks go to Adithya Pentela for
19
+ the spot.
20
+ * Refactored the specs a bit, adding a spec_helper.rb. This was mainly
21
+ for JRuby compatibility.
22
+ * Updates to the travis.yml file for both Ruby and JRuby versions.
23
+ * Removed the doc directory and all the files it contained. It was
24
+ redundant, and some of the information was wrong. All of the
25
+ documentation you need is on the wiki.
26
+ * Cleaned up the MANIFEST file, updated the gemspec, and fixed the
27
+ license name, which was missing a hyphen.
28
+
29
+ == 1.2.1 - 8-Jun-2018
30
+ * The code for OSX is now more efficient when a pid argument is provided.
31
+ Thanks go to Nick LaMuro for his efforts.
32
+ * Added metadata to the gemspec.
33
+ * Switched the README (now README.md) to markdown format. Thanks go to
34
+ Tim Meusel for the update.
35
+ * Updated the cert. Should be good for ten years now.
36
+
1
37
  == 1.2.0 - 20-Feb-2018
2
38
  * There has been an API change. The ProcTable.ps method now uses keyword
3
39
  arguments. The 'pid' option is universal, the rest depend on the platform.
40
+ As part of this change, support for Ruby < 2.0 has been dropped.
4
41
  * Support for HP-UX has been dropped, both because it was the last remaining
5
42
  platform that still used C code, and because it's basically a dead platform.
6
43
  * There are no more platform-specific gems. There is now a single gem that
data/LICENSE ADDED
@@ -0,0 +1,177 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
@@ -1,18 +1,12 @@
1
1
  * CHANGES
2
+ * LICENSE
2
3
  * MANIFEST
3
4
  * Rakefile
4
5
  * README
5
6
  * sys-proctable.gemspec
6
- * doc/aix.txt
7
- * doc/bsd.txt
8
- * doc/hpux.txt
9
- * doc/linux.txt
10
- * doc/solaris.txt
11
- * doc/top.txt
12
- * doc/windows.txt
7
+ * benchmarks/bench_ps.rb
8
+ * benchmarks/bench_ips_ps.rb
13
9
  * example/example_ps.rb
14
- * ext/hpux/extconf.rb
15
- * ext/hpux/sys/proctable.c
16
10
  * lib/sys-proctable.rb
17
11
  * lib/sys/top.rb
18
12
  * lib/sys/proctable/version.rb
@@ -26,7 +20,6 @@
26
20
  * test/test_sys_proctable_all.rb
27
21
  * test/test_sys_proctable_darwin.rb
28
22
  * test/test_sys_proctable_freebsd.rb
29
- * test/test_sys_proctable_hpux.rb
30
23
  * test/test_sys_proctable_linux.rb
31
24
  * test/test_sys_proctable_sunos.rb
32
25
  * test/test_sys_proctable_windows.rb
@@ -0,0 +1,158 @@
1
+ # sys-proctable
2
+
3
+ ## Description
4
+
5
+ A Ruby interface for gathering process information.
6
+
7
+ ## Prerequisites
8
+
9
+ * RSpec 3.x (development only)
10
+
11
+ ## Supported Platforms
12
+
13
+ * Windows 2000 or later
14
+ * Linux 2.6+
15
+ * FreeBSD
16
+ * Solaris 8+
17
+ * OS X 10.7+
18
+ * AIX 5.3+
19
+
20
+ ## Installation
21
+
22
+ ```sh
23
+ gem install sys-proctable
24
+ ```
25
+
26
+ For version 1.1.5 or earlier, you may need to specify a platform in some cases. For example:
27
+
28
+ ```sh
29
+ gem install sys-proctable --platform mswin32 # Windows
30
+ gem install sys-proctable --platform sunos # Solaris
31
+ gem install sys-proctable --platform linux # Linux
32
+ gem install sys-proctable --platform freebsd # FreeBSD
33
+ gem install sys-proctable --platform darwin # OS X
34
+ ```
35
+
36
+ ## Synopsis
37
+
38
+ ```ruby
39
+ require 'sys/proctable'
40
+ include Sys
41
+
42
+ # Everything
43
+ ProcTable.ps{ |p|
44
+ puts p.pid.to_s
45
+ puts p.comm
46
+ # ...
47
+ }
48
+
49
+ # Just one process
50
+ s = ProcTable.ps(pid: 2123)
51
+ puts s.pid.to_s
52
+ puts s.comm
53
+ # ...
54
+
55
+ # Return the results as an array of ProcTableStructs
56
+ a = ProcTable.ps
57
+ a.each do |p|
58
+ puts p.pid
59
+ # ...
60
+ end
61
+ ```
62
+
63
+ ## Notes
64
+
65
+ Various platforms support different options. Mostly this is to let you
66
+ skip the collection of certain bits of information in order to improve
67
+ speed and/or reduce memory. For example on Linux you can do this to
68
+ skip the collection of smaps information:
69
+
70
+ ```ruby
71
+ Sys::ProcTable.ps(smaps: false)
72
+ ```
73
+
74
+ Windows users may send a host name to get process information from a
75
+ different host. This relies on the WMI service running.
76
+
77
+ ```ruby
78
+ Sys::ProcTable.ps(host: some_host)
79
+ ```
80
+
81
+ ## Known Issues
82
+
83
+ ### FreeBSD
84
+
85
+ A kvm interface is used. That means the owner of the process using the
86
+ sys-proctable library needs to be a member of the kvm group (or root).
87
+
88
+ ### Bundler
89
+
90
+ For version 1.1.5 or earlier, Bundler seems to have trouble installing the
91
+ proper gem because of the platform specific gem names. To deal with that,
92
+ run this command first:
93
+
94
+ ```sh
95
+ bundle config specific_platform true
96
+ ```
97
+
98
+ You should not have to do this for version 1.2.0 or later.
99
+
100
+ ### Solaris
101
+
102
+ The cmdline member on Solaris is limited to 80 characters unless you (or
103
+ your program) own the process. This is a Solaris design flaw/feature.
104
+
105
+ ### OS X
106
+
107
+ The libproc interface is used. That means you will only get list of
108
+ processes that you have access to. To get a full listing, run as root.
109
+
110
+ ## Future Plans
111
+
112
+ Support for Solaris will probably be dropped in the next major release.
113
+
114
+ ## Acknowledgements
115
+
116
+ This library was originally based on the Perl module Proc::ProcessTable
117
+ by Dan Urist. Many ideas, as well as large chunks of code, were taken
118
+ from his work. So, a big THANK YOU goes out to Dan Urist.
119
+
120
+ A big thanks also goes out to Mike Hall who was very helpful with ideas,
121
+ logic and testing.
122
+
123
+ Thanks also go to Sean Chittenden for providing an account on one of his
124
+ FreeBSD machines. This is how the FreeBSD support was (initially) added.
125
+
126
+ Thanks go to James Hranicky for providing a patch that grabs name, eid,
127
+ euid, gid and guid info in the Linux version, along with some general
128
+ debugging help.
129
+
130
+ Thanks go to David Felstead for the original OS X code. Thanks also go
131
+ to Matthias Zirnstein for adding the original cmdline support for OS X.
132
+
133
+ Finally I'd like to thank all the folks who have submitted bug reports
134
+ and/or patches.
135
+
136
+ ## Help Wanted
137
+
138
+ I do not have access to all platforms. If your platform is not supported
139
+ then you will need to either submit a patch or give me a remote account
140
+ on a box with a compiler so that I can write the code.
141
+
142
+ ## More documentation
143
+
144
+ See the documentation under the 'doc' directory for more information,
145
+ including platform specific notes and issues.
146
+
147
+ ## License
148
+
149
+ Apache 2.0
150
+
151
+ ## Copyright
152
+
153
+ (C) 2003-2019 Daniel J. Berger
154
+ All Rights Reserved.
155
+
156
+ ## Author
157
+
158
+ Daniel J. Berger
data/Rakefile CHANGED
@@ -51,7 +51,7 @@ end
51
51
 
52
52
  desc 'Run the test suite for the sys-proctable library'
53
53
  RSpec::Core::RakeTask.new(:spec) do |t|
54
- t.pattern = ['spec/sys_proctable_all_spec.rb']
54
+ t.pattern = ['spec/spec_helper.rb', 'spec/sys_proctable_all_spec.rb']
55
55
 
56
56
  case CONFIG['host_os']
57
57
  when /aix/i
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'json'
4
+ require 'optparse'
5
+ require 'rbconfig'
6
+ require 'benchmark/ips'
7
+
8
+ @source, @gem = false
9
+
10
+ OptionParser.new do |opt|
11
+ opt.banner = "Usage: #{File.basename $0} [--gem|--source]"
12
+
13
+ opt.separator ""
14
+ opt.separator "Benchmark IPS (iterations per second) changes between"
15
+ opt.separator "source version of sys-proctable and previous gem"
16
+ opt.separator "version."
17
+ opt.separator ""
18
+ opt.separator "Requires that the both the source version of the gem"
19
+ opt.separator "be installed (run `rake install` to do this after"
20
+ opt.separator "each of your changes) and version installed via"
21
+ opt.separator "rubygems."
22
+ opt.separator ""
23
+ opt.separator "To run, call with `--gem` two times, and then with "
24
+ opt.separator "`--source` two times again."
25
+ opt.separator ""
26
+
27
+ opt.on("--source") { @source = true }
28
+ opt.on("--gem") { @gem = true }
29
+ end.parse!
30
+
31
+ if @source && !@gem
32
+ # Being paranoid here and making sure we get the version installed to
33
+ # sitelibdir
34
+ require File.join(RbConfig::CONFIG["sitelibdir"], "sys", "proctable")
35
+ else
36
+ @gem = true
37
+ require 'sys-proctable'
38
+ end
39
+
40
+ Benchmark.ips do |bench|
41
+ bench.report("Block form - pre patch") do
42
+ (puts "ERR: Please run with --gem"; exit 1) unless @gem
43
+ Sys::ProcTable.ps {}
44
+ end
45
+
46
+ bench.report("Non-block form - pre patch") do
47
+ (puts "ERR: Please run with --gem"; exit 1) unless @gem
48
+ Sys::ProcTable.ps
49
+ end
50
+
51
+ bench.report("Block form - post patch") do
52
+ (puts "ERR: Please run with --source"; exit 1) unless @source
53
+ Sys::ProcTable.ps {}
54
+ end
55
+
56
+ bench.report("Non-block form - post patch") do
57
+ (puts "ERR: Please run with --source"; exit 1) unless @source
58
+ Sys::ProcTable.ps
59
+ end
60
+
61
+ bench.hold! "bench_ips_ps.results"
62
+ bench.compare!
63
+ end