sys-proctable 0.7.6 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/{CHANGES → CHANGES.rdoc} +197 -0
- data/LICENSE +177 -0
- data/MANIFEST.rdoc +26 -0
- data/README.md +158 -0
- data/Rakefile +94 -0
- data/benchmarks/bench_ips_ps.rb +63 -0
- data/benchmarks/bench_ps.rb +21 -0
- data/examples/example_ps.rb +20 -0
- data/lib/aix/sys/proctable.rb +458 -0
- data/lib/darwin/sys/proctable.rb +406 -0
- data/lib/freebsd/sys/proctable.rb +363 -0
- data/lib/linux/sys/proctable.rb +315 -0
- data/lib/linux/sys/proctable/cgroup_entry.rb +50 -0
- data/lib/linux/sys/proctable/smaps.rb +118 -0
- data/lib/sunos/sys/proctable.rb +456 -0
- data/lib/sys-proctable.rb +1 -0
- data/lib/sys-top.rb +1 -0
- data/lib/sys/proctable.rb +18 -0
- data/lib/sys/proctable/version.rb +6 -0
- data/lib/sys/top.rb +28 -19
- data/lib/windows/sys/proctable.rb +208 -0
- data/spec/spec_helper.rb +22 -0
- data/spec/sys_proctable_aix_spec.rb +328 -0
- data/spec/sys_proctable_all_spec.rb +90 -0
- data/spec/sys_proctable_darwin_spec.rb +120 -0
- data/spec/sys_proctable_freebsd_spec.rb +210 -0
- data/spec/sys_proctable_linux_spec.rb +323 -0
- data/spec/sys_proctable_sunos_spec.rb +316 -0
- data/spec/sys_proctable_windows_spec.rb +317 -0
- data/spec/sys_top_spec.rb +51 -0
- data/sys-proctable.gemspec +48 -0
- metadata +150 -67
- metadata.gz.sig +7 -0
- data/MANIFEST +0 -41
- data/README +0 -140
- data/doc/freebsd.txt +0 -90
- data/doc/hpux.txt +0 -77
- data/doc/linux.txt +0 -85
- data/doc/solaris.txt +0 -99
- data/doc/top.txt +0 -53
- data/doc/windows.txt +0 -122
- data/ext/extconf.rb +0 -98
- data/ext/sunos/sunos.c +0 -374
- data/ext/sunos/sunos.h +0 -177
- data/ext/version.h +0 -2
- data/test/tc_all.rb +0 -59
- data/test/tc_freebsd.rb +0 -45
- data/test/tc_hpux.rb +0 -49
- data/test/tc_kvm_bsd.rb +0 -31
- data/test/tc_linux.rb +0 -45
- data/test/tc_sunos.rb +0 -52
- data/test/tc_top.rb +0 -26
- data/test/tc_windows.rb +0 -40
- data/test/test_memleak.rb +0 -54
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8c36a4455aa4fd0172d51e7e1e69b69c180a86da3570247c6958c2bdee34a314
|
4
|
+
data.tar.gz: 2659ffc977988520db6d68703efa079815d966fd0320679c8cc961a75daf3f13
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d2a101a16b5c3a767917fc2f4e32633f20785a9d678c46f6def07aabc3d5392238bfe8b48a73f203f607a161c1908f0e412e73f5b2a6c92a56c16c8e65c72594
|
7
|
+
data.tar.gz: c372c2763018d53376e11aaaa8004071eff144dfd3830c1fb15dbfcc4f35316a2870b1519d0a77613a3465e31bcca0da9f0397dba0c1bfaf1e0e9b0649029a04
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
Binary file
|
data/{CHANGES → CHANGES.rdoc}
RENAMED
@@ -1,3 +1,200 @@
|
|
1
|
+
== 1.2.4 - 18-Jun-2020
|
2
|
+
* Added the num_threads field for Linux. This was originally a dead field in
|
3
|
+
older versions of Linux that was skipped, but as of Linux 2.6+ it actually
|
4
|
+
holds meaningful data.
|
5
|
+
* Updated the specs for Linux.
|
6
|
+
|
7
|
+
== 1.2.3 - 17-Mar-2020
|
8
|
+
* Properly include a copy of Apache-2.0 in LICENSE file as part of library.
|
9
|
+
* Add explicit .rdoc extensions to CHANGES and MANIFEST files.
|
10
|
+
|
11
|
+
== 1.2.2 - 12-Aug-2019
|
12
|
+
* Added compatibility for JRuby on Mac which apparently doesn't define a
|
13
|
+
read_uint64 method, nor a CharArray. Thanks go to Adithya Pentela for
|
14
|
+
the spot.
|
15
|
+
* Refactored the specs a bit, adding a spec_helper.rb. This was mainly
|
16
|
+
for JRuby compatibility.
|
17
|
+
* Updates to the travis.yml file for both Ruby and JRuby versions.
|
18
|
+
* Removed the doc directory and all the files it contained. It was
|
19
|
+
redundant, and some of the information was wrong. All of the
|
20
|
+
documentation you need is on the wiki.
|
21
|
+
* Cleaned up the MANIFEST file, updated the gemspec, and fixed the
|
22
|
+
license name, which was missing a hyphen.
|
23
|
+
|
24
|
+
== 1.2.1 - 8-Jun-2018
|
25
|
+
* The code for OSX is now more efficient when a pid argument is provided.
|
26
|
+
Thanks go to Nick LaMuro for his efforts.
|
27
|
+
* Added metadata to the gemspec.
|
28
|
+
* Switched the README (now README.md) to markdown format. Thanks go to
|
29
|
+
Tim Meusel for the update.
|
30
|
+
* Updated the cert. Should be good for ten years now.
|
31
|
+
|
32
|
+
== 1.2.0 - 20-Feb-2018
|
33
|
+
* There has been an API change. The ProcTable.ps method now uses keyword
|
34
|
+
arguments. The 'pid' option is universal, the rest depend on the platform.
|
35
|
+
As part of this change, support for Ruby < 2.0 has been dropped.
|
36
|
+
* Support for HP-UX has been dropped, both because it was the last remaining
|
37
|
+
platform that still used C code, and because it's basically a dead platform.
|
38
|
+
* There are no more platform-specific gems. There is now a single gem that
|
39
|
+
will load the appropriate code based on your host's operating system.
|
40
|
+
* The tests were switched from test-unit to rspec.
|
41
|
+
* Lots of Rakefile updates based on the above changes.
|
42
|
+
* The cert was updated.
|
43
|
+
|
44
|
+
== 1.1.5 - 10-Aug-2017
|
45
|
+
* Fixed a warning that cropped up in Ruby 2.4.x because I was type checking
|
46
|
+
against Fixnum. Those have been replaced with Numeric.
|
47
|
+
|
48
|
+
== 1.1.4 - 30-Mar-2017
|
49
|
+
* Fixed a potential issue where OSX could return a struct with invalid data.
|
50
|
+
* Set the default field to :pid for OSX when using Sys::Top.
|
51
|
+
* Fixed a duplicate test warning for OSX.
|
52
|
+
|
53
|
+
== 1.1.3 - 28-Sep-2016
|
54
|
+
* Fixed an issue on OSX where the value returned for argc is invalid.
|
55
|
+
|
56
|
+
== 1.1.2 - 18-Sep-2016
|
57
|
+
* Fixed cmdline parsing and handling for OSX. Thanks go to Ben Mathwig for
|
58
|
+
the spot and the patch.
|
59
|
+
|
60
|
+
== 1.1.1 - 30-Jun-2016
|
61
|
+
* Added thread information for OS X.
|
62
|
+
* Fixed VERSION constant for HP-UX.
|
63
|
+
|
64
|
+
== 1.1.0 - 27-Jun-2016
|
65
|
+
* License was changed to Apache 2.0.
|
66
|
+
* The OS X version now requires OS X 10.7 or later.
|
67
|
+
* Scrapped the C implementation for OS X, and replaced it with a libproc wrapper
|
68
|
+
using FFI, so it is now pure Ruby. Note that some new struct members have been
|
69
|
+
added, while others have been dropped. This includes pctcpu, so Sys::Top does
|
70
|
+
not work at the moment.
|
71
|
+
* Rakefile updates to accomodate the changes for OS X.
|
72
|
+
* Some test suite updates and refactoring.
|
73
|
+
|
74
|
+
== 1.0.0 - 11-Jan-2016
|
75
|
+
* Added smaps information for Linux. Thanks go to Joe Rafaniello for the patch.
|
76
|
+
* This really should not have been a major release, sorry.
|
77
|
+
|
78
|
+
== 0.9.9 - 8-Nov-2015
|
79
|
+
* Added support for cgroups on Linux. Thanks go to Dennis Günnewig for the patch.
|
80
|
+
* Added a sys-proctable.rb file for convenience.
|
81
|
+
* This gem is now signed.
|
82
|
+
* Gem related tasks in the Rakefile now assume Rubygems 2.x.
|
83
|
+
|
84
|
+
== 0.9.8 - 18-Apr-2015
|
85
|
+
* Fixed a bug in the gemspec. Last version got yanked.
|
86
|
+
|
87
|
+
== 0.9.7 - 18-Apr-2015
|
88
|
+
* Fixed a bug in the OSX code that could cause the ps method to fail. Thanks
|
89
|
+
go to Koshevoy Anton for the spot.
|
90
|
+
* Some internal refactoring of version handling. Now all platforms use a
|
91
|
+
single version file.
|
92
|
+
* Replaced vm_size_t and lwpid_t with universal data types on FreeBSD because
|
93
|
+
FFI on FreeBSD 10 no longer understands them. Thanks go to Mike Owens for
|
94
|
+
the spot.
|
95
|
+
|
96
|
+
== 0.9.6 - 24-Feb-2015
|
97
|
+
* Added NLWP field on Linux. Thanks go to Rich Chatterton for the patch.
|
98
|
+
|
99
|
+
== 0.9.5 - 10-Feb-2015
|
100
|
+
* Significant cleanup and memory reduction of the OSX code. Thanks go
|
101
|
+
to Ivan (toy) for the patches.
|
102
|
+
* Skip over /proc/<file>/status if unreadable on Linux. Thanks go to Jianjun
|
103
|
+
Mao for the patch.
|
104
|
+
|
105
|
+
== 0.9.4 - 4-Mar-2014
|
106
|
+
* Added support for AIX 5.3 or later courtesy of Rick Ohnemus.
|
107
|
+
* The Solaris version now uses FFI structs instead of a packed array.
|
108
|
+
It solved issues with 64-bit versions of Ruby and it's self-documenting.
|
109
|
+
* The FreeBSD version has been converted to use FFI. In addition, additional
|
110
|
+
struct members have been added, and members that previously returned nil
|
111
|
+
now return meaningful data.
|
112
|
+
* Support for NetBSD and OpenBSD has been temporarily dropped. Considering
|
113
|
+
that the C code did not build on those platforms anyway, I doubt most of
|
114
|
+
you will notice. Patches for those platforms are welcome, but only using FFI.
|
115
|
+
|
116
|
+
== 0.9.3 - 17-Mar-2013
|
117
|
+
* Fixed a bug on OSX where a long command string arg could cause
|
118
|
+
a segfault. Thanks go to Nathaniel Bibler for the spot.
|
119
|
+
* Changed the gem platform from mingw to mingw32 for Windows.
|
120
|
+
|
121
|
+
== 0.9.2 - 8-Oct-2012
|
122
|
+
* Added cmdline support for OS X. Thanks go to Matthias Zirnstein for
|
123
|
+
the patch.
|
124
|
+
* Warning cleanup for 1.9.
|
125
|
+
* Updated the gem platform handling. Replaced the borked string approach
|
126
|
+
with a two element array for Gem::Platform.new.
|
127
|
+
* MS date strings are now parse with DateTime instead of Date.
|
128
|
+
|
129
|
+
== 0.9.1 - 3-Aug-2011
|
130
|
+
* Added the pctcpu and pctmem members for Linux.
|
131
|
+
* Added Errno::ESRCH to a rescue clause on Linux that fixed a bug
|
132
|
+
where a missing entry wasn't being skipped when run as root. Thanks
|
133
|
+
go to Austin Ziegler for the spot and patch.
|
134
|
+
* Fixed a build warning for Darwin.
|
135
|
+
* Updates to the test suite for both Darwin and Linux.
|
136
|
+
* Added an explicit type check for BSD for pids.
|
137
|
+
* Added nicer error messages for BSD if kvm_open fails.
|
138
|
+
* Added .core files to the clean task.
|
139
|
+
* Altered the platform settings in the Rakefile so that generated gems
|
140
|
+
use 'universal' platform architectures for any particular operating system.
|
141
|
+
|
142
|
+
== 0.9.0 - 14-Oct-2009
|
143
|
+
* Changed the license to Artistic 2.0.
|
144
|
+
* Fixed a bug in the OS X code where a segfault would occur when an attempt
|
145
|
+
was made to gather resource usage information on zombie processes. From
|
146
|
+
now on that information is always set to nil for zombie processes. Thanks
|
147
|
+
go to Tom Lianza for the spot and Philip Kromer for investigating the
|
148
|
+
root cause of the failure.
|
149
|
+
* Removed the FreeBSD code that read out of /proc. It was a pain from a
|
150
|
+
maintenance point of view, and most FreeBSD installs do not mount /proc
|
151
|
+
by default. The FreeBSD platform now uses the same code that the other
|
152
|
+
BSD platforms use.
|
153
|
+
* Fixed a bug in the BSD code where the ProcTable::Error class had the
|
154
|
+
wrong parent class.
|
155
|
+
* Some major gemspec updates, including an updated license. The platform
|
156
|
+
handling logic is now in the Rakefile in the 'gem' task.
|
157
|
+
* Updated the README file to include an additional acknowledgement, a
|
158
|
+
license change and some minor formatting changes.
|
159
|
+
* The test-unit library was changed from a runtime to a development dependency.
|
160
|
+
|
161
|
+
== 0.8.1 - 6-Apr-2009
|
162
|
+
* The Linux and Solaris libraries now handle the possibility of a process
|
163
|
+
terminating in the middle of a read more gracefully. If that happens, they
|
164
|
+
merely skip to the next record, i.e. it's all or nothing. Thanks go to
|
165
|
+
Heejong Lee for the spot and patch.
|
166
|
+
* Fixed a bug in the Linux version where embedded nulls were not being
|
167
|
+
stripped out of the cmdline data.
|
168
|
+
* Added the comm alias back to the Solaris version. Thanks go to Jun Young Kim
|
169
|
+
for the spot.
|
170
|
+
|
171
|
+
== 0.8.0 - 26-Jan-2009
|
172
|
+
* The Linux and Solaris versions of this library are now pure Ruby. Be warned,
|
173
|
+
however, that only Solaris 8 and later are now supported. This may change
|
174
|
+
in a future release if there's demand to support 2.6 and 2.7.
|
175
|
+
* Some Struct::ProcTableStruct members have changed. As a general rule they
|
176
|
+
now more closely match the C struct member name. See individual platforms
|
177
|
+
for more details.
|
178
|
+
* Bug fix for the cmd_args struct member on Solaris.
|
179
|
+
* Bug fixes for OS X. Added a VERSION constant, fixed struct name, and changed
|
180
|
+
pct_cpu to pctcpu.
|
181
|
+
* The .new method is now explicitly illegal.
|
182
|
+
* The Struct::ProcTableStruct instances are now frozen. This is read-only data.
|
183
|
+
* Added the peak_page_file_usage and status members on MS Windows. The status
|
184
|
+
member is always nil, but was added for completeness.
|
185
|
+
* Fixed the quota_peak_paged_pool_usage member on MS Windows.
|
186
|
+
* ProcTableError is now ProcTable::Error.
|
187
|
+
* Minor test case fix for kvm/bsd based versions.
|
188
|
+
* Added the 'time' library as a require for Windows (to parse MS date/time
|
189
|
+
format strings).
|
190
|
+
* The kvm (bsd.c) implementation now works for FreeBSD 7.
|
191
|
+
* Added many more tests.
|
192
|
+
* Added some benchmarking code in the 'benchmarks' directory.
|
193
|
+
* Added a 'bench' Rake task.
|
194
|
+
* Renamed the test_ps.rb file to example_ps.rb in order to avoid any possible
|
195
|
+
confusion with actual test files.
|
196
|
+
* Added an 'example' rake task to run the example file.
|
197
|
+
|
1
198
|
== 0.7.6 - 11-Jul-2007
|
2
199
|
* Fixed the starttime for Linux. Thanks go to Yaroslav Dmitriev for the spot.
|
3
200
|
* Fixed a bug in the MS Windows version within a private method that parsed
|
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
|
data/MANIFEST.rdoc
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
* CHANGES
|
2
|
+
* LICENSE
|
3
|
+
* MANIFEST
|
4
|
+
* Rakefile
|
5
|
+
* README
|
6
|
+
* sys-proctable.gemspec
|
7
|
+
* benchmarks/bench_ps.rb
|
8
|
+
* benchmarks/bench_ips_ps.rb
|
9
|
+
* example/example_ps.rb
|
10
|
+
* lib/sys-proctable.rb
|
11
|
+
* lib/sys/top.rb
|
12
|
+
* lib/sys/proctable/version.rb
|
13
|
+
* lib/aix/sys/proctable.rb
|
14
|
+
* lib/darwin/sys/proctable.rb
|
15
|
+
* lib/freebsd/sys/proctable.rb
|
16
|
+
* lib/linux/sys/proctable.rb
|
17
|
+
* lib/sunos/sys/proctable.rb
|
18
|
+
* lib/windows/sys/proctable.rb
|
19
|
+
* test/test_sys_proctable_aix.rb
|
20
|
+
* test/test_sys_proctable_all.rb
|
21
|
+
* test/test_sys_proctable_darwin.rb
|
22
|
+
* test/test_sys_proctable_freebsd.rb
|
23
|
+
* test/test_sys_proctable_linux.rb
|
24
|
+
* test/test_sys_proctable_sunos.rb
|
25
|
+
* test/test_sys_proctable_windows.rb
|
26
|
+
* test/test_sys_top.rb
|
data/README.md
ADDED
@@ -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
|