sys-proctable 0.7.6 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +7 -0
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +1 -0
  4. data/CHANGES +165 -0
  5. data/MANIFEST +33 -41
  6. data/README +115 -135
  7. data/Rakefile +94 -0
  8. data/benchmarks/bench_ps.rb +21 -0
  9. data/doc/top.txt +5 -11
  10. data/examples/example_ps.rb +20 -0
  11. data/lib/aix/sys/proctable.rb +458 -0
  12. data/lib/darwin/sys/proctable.rb +363 -0
  13. data/lib/freebsd/sys/proctable.rb +363 -0
  14. data/lib/linux/sys/proctable.rb +314 -0
  15. data/lib/linux/sys/proctable/cgroup_entry.rb +50 -0
  16. data/lib/linux/sys/proctable/smaps.rb +118 -0
  17. data/lib/sunos/sys/proctable.rb +456 -0
  18. data/lib/sys-proctable.rb +1 -0
  19. data/lib/sys-top.rb +1 -0
  20. data/lib/sys/proctable.rb +18 -0
  21. data/lib/sys/proctable/version.rb +6 -0
  22. data/lib/sys/top.rb +28 -19
  23. data/lib/windows/sys/proctable.rb +208 -0
  24. data/spec/sys_proctable_aix_spec.rb +328 -0
  25. data/spec/sys_proctable_all_spec.rb +89 -0
  26. data/spec/sys_proctable_darwin_spec.rb +120 -0
  27. data/spec/sys_proctable_freebsd_spec.rb +210 -0
  28. data/spec/sys_proctable_linux_spec.rb +310 -0
  29. data/spec/sys_proctable_sunos_spec.rb +316 -0
  30. data/spec/sys_proctable_windows_spec.rb +317 -0
  31. data/spec/sys_top_spec.rb +51 -0
  32. data/sys-proctable.gemspec +38 -0
  33. metadata +140 -64
  34. metadata.gz.sig +0 -0
  35. data/doc/freebsd.txt +0 -90
  36. data/doc/hpux.txt +0 -77
  37. data/doc/linux.txt +0 -85
  38. data/doc/solaris.txt +0 -99
  39. data/doc/windows.txt +0 -122
  40. data/ext/extconf.rb +0 -98
  41. data/ext/sunos/sunos.c +0 -374
  42. data/ext/sunos/sunos.h +0 -177
  43. data/ext/version.h +0 -2
  44. data/test/tc_all.rb +0 -59
  45. data/test/tc_freebsd.rb +0 -45
  46. data/test/tc_hpux.rb +0 -49
  47. data/test/tc_kvm_bsd.rb +0 -31
  48. data/test/tc_linux.rb +0 -45
  49. data/test/tc_sunos.rb +0 -52
  50. data/test/tc_top.rb +0 -26
  51. data/test/tc_windows.rb +0 -40
  52. data/test/test_memleak.rb +0 -54
@@ -1,26 +0,0 @@
1
- ##############################################################################
2
- # tc_top.rb
3
- #
4
- # Test suite for the sys-top package that is included with this distribution.
5
- ##############################################################################
6
- require 'test/unit'
7
- require 'sys/top'
8
- include Sys
9
-
10
- class TC_Top < Test::Unit::TestCase
11
- def test_version
12
- assert_equal('1.0.1', Top::VERSION)
13
- end
14
-
15
- def test_top
16
- assert_respond_to(Top,:top)
17
- assert_nothing_raised{ Top.top }
18
- assert_nothing_raised{ Top.top(5) }
19
- assert_nothing_raised{ Top.top(5, 'cmdline') }
20
- assert_raises(ArgumentError){ Top.top(1,'foo',2) }
21
- assert_kind_of(Array, Top.top)
22
- assert_equal(10, Top.top.length)
23
- assert_equal(5, Top.top(5).length)
24
- assert_kind_of(Struct::ProcTableStruct, Top.top.first)
25
- end
26
- end
@@ -1,40 +0,0 @@
1
- ##################################################
2
- # tc_windows.rb
3
- #
4
- # Test suite for sys-proctable for MS Windows
5
- ##################################################
6
- require 'sys/proctable'
7
- require 'test/unit'
8
- require 'test/tc_all'
9
-
10
- class TC_ProcTable_MSWindows < Test::Unit::TestCase
11
- def setup
12
- @fields = %w/
13
- caption cmdline comm creation_class_name creation_date
14
- cs_creation_class_name cs_name description executable_path
15
- execution_state handle handle_count install_date kernel_mode_time
16
- maximum_working_set_size minimum_working_set_size name
17
- os_creation_class_name os_name other_operation_count
18
- other_transfer_count page_faults page_file_usage
19
- peak_virtual_size ppid peak_working_set_size priority
20
- private_page_count pid quota_non_paged_pool_usage
21
- quota_paged_pool_usage quota_peak_non_paged_pool_usage
22
- quota_non_paged_pool_usage read_operation_count read_transfer_count
23
- session_id termination_date thread_count user_mode_time virtual_size
24
- windows_version working_set_size write_operation_count write_transfer_count
25
- /
26
- @pt = ProcTable.ps.first
27
- end
28
-
29
- def test_field_members
30
- msg = "Struct members don't match expected fields"
31
- assert_equal(@fields.length, @pt.length, "Bad length")
32
- assert_equal(@fields, ProcTable.fields, "Bad fields")
33
- assert_equal(@fields, @pt.members, msg)
34
- end
35
-
36
- def teardown
37
- @pt = nil
38
- @fields = nil
39
- end
40
- end
@@ -1,54 +0,0 @@
1
- ##########################################################
2
- # test_memleak.rb
3
- #
4
- # Test script to check for memory leaks. For now, it is
5
- # only supported on Linux.
6
- ##########################################################
7
- unless PLATFORM =~ /linux/i
8
- puts "This program is currently only supported on Linux"
9
- puts "Exiting program"
10
- exit!
11
- end
12
-
13
- base = File.basename(Dir.pwd)
14
- if base == "test" || base =~ /^sys-proctable.*/
15
- require "fileutils"
16
- Dir.chdir("..") if base == "test"
17
- $LOAD_PATH.unshift(Dir.pwd)
18
- File.delete("sys/proctable.so") rescue nil
19
- Dir.mkdir("sys") rescue nil
20
- FileUtils.cp("ext/proctable.so", "sys")
21
- end
22
-
23
-
24
- require "sys/proctable"
25
- include Sys
26
-
27
- pid = Process.pid
28
- fd_file = "/proc/#{pid}/fd/*"
29
-
30
- initial_fd = 0 # initial number of file descriptors
31
- found = false
32
-
33
- puts "ProcTable VERSION: " + ProcTable::VERSION
34
-
35
- 0.upto(50){ |n|
36
- ProcTable.ps
37
- if 0 == n
38
- initial_fd = Dir[fd_file].length + 1 # one fd margin of error
39
- puts "Initial file descriptors in use: #{initial_fd - 1}"
40
- else
41
- current_fd = Dir[fd_file].length
42
- if current_fd > initial_fd
43
- puts "Possible memory leak. FD count now up to #{current_fd}"
44
- found = true
45
- end
46
- end
47
- }
48
-
49
- if found
50
- puts "You appear to have a file descriptor issue"
51
- puts "After 50 iterations you had #{n} file descriptors open"
52
- else
53
- puts "No apparent fd leaks"
54
- end