gc_ext 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 08938c8c0002022acee1f641bc862d562466cd89
4
+ data.tar.gz: fea3c495621fd2fdec6e6b9175df7ba1575f8a9e
5
+ SHA512:
6
+ metadata.gz: 8f05ce9c94affc90b5a3f19dac2b2d9d1fd5eac5a873da701d908d47ea0fbf873dadb360ccaa9b3b6b805e9db1c5df8d5b0580af2e4d477816f3335971942c36
7
+ data.tar.gz: 2e0815ff4a879881ddae11dd55846b3e934ae3942caa98f1d05171d1de6a78844d8311582e168c46f259d4a1995bd9ef08ecc6762e8eeed37b44ed8ea68ee4b0
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ lib/gc_ext.so
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in gc-inspector.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Sergey Avseyev
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,17 @@
1
+ def gemspec
2
+ @clean_gemspec ||= eval(File.read(File.expand_path('gc_ext.gemspec', File.dirname(__FILE__))))
3
+ end
4
+
5
+ require "rake/extensiontask"
6
+ Rake::ExtensionTask.new("gc_ext", gemspec) do |ext|
7
+ CLEAN.include "#{ext.lib_dir}/*.#{RbConfig::CONFIG['DLEXT']}"
8
+ end
9
+
10
+ require 'rubygems/package_task'
11
+ Gem::PackageTask.new(gemspec) do |pkg|
12
+ end
13
+
14
+ desc 'Start an irb session and load the library.'
15
+ task :console do
16
+ exec "irb -I lib -rgc_ext"
17
+ end
@@ -0,0 +1,6 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'mkmf'
4
+
5
+ have_library("procps", "look_up_our_self", "proc/readproc.h")
6
+ create_makefile("gc_ext")
@@ -0,0 +1,30 @@
1
+ /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
+
3
+ #include <ruby.h>
4
+ #include <proc/readproc.h>
5
+
6
+ static VALUE ge_mGC;
7
+ static VALUE ge_sym_vsize;
8
+
9
+ static VALUE
10
+ ge_procinfo_get(VALUE self)
11
+ {
12
+ struct proc_t proc;
13
+ VALUE ret;
14
+
15
+ ret = rb_hash_new();
16
+ look_up_our_self(&proc);
17
+ rb_hash_aset(ret, ge_sym_vsize, ULONG2NUM(proc.vsize));
18
+
19
+ (void)self;
20
+ return ret;
21
+ }
22
+
23
+ void
24
+ Init_gc_ext(void)
25
+ {
26
+ ge_sym_vsize = ID2SYM(rb_intern("vsize"));
27
+
28
+ ge_mGC = rb_const_get(rb_cObject, rb_intern("GC"));
29
+ rb_define_singleton_method(ge_mGC, "procinfo", ge_procinfo_get, 0);
30
+ }
data/gc_ext.gemspec ADDED
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "gc_ext"
7
+ spec.version = "0.0.1"
8
+ spec.author = "Sergey Avseyev"
9
+ spec.email = "sergey.avseyev@gmail.com"
10
+ spec.description = %q{Extension for inspection memory and GC}
11
+ spec.summary = %q{Memory and GC inspector}
12
+ spec.homepage = "https://github.com/avsej/gc-inspector"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files`.split($/)
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.3"
21
+ spec.add_development_dependency "rake"
22
+ spec.add_development_dependency 'rake-compiler', '>= 0.7.5'
23
+ end
metadata ADDED
@@ -0,0 +1,92 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gc_ext
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Sergey Avseyev
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-07-27 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.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake-compiler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: 0.7.5
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 0.7.5
55
+ description: Extension for inspection memory and GC
56
+ email: sergey.avseyev@gmail.com
57
+ executables: []
58
+ extensions: []
59
+ extra_rdoc_files: []
60
+ files:
61
+ - .gitignore
62
+ - Gemfile
63
+ - LICENSE.txt
64
+ - Rakefile
65
+ - ext/gc_ext/extconf.rb
66
+ - ext/gc_ext/gc_ext.c
67
+ - gc_ext.gemspec
68
+ homepage: https://github.com/avsej/gc-inspector
69
+ licenses:
70
+ - MIT
71
+ metadata: {}
72
+ post_install_message:
73
+ rdoc_options: []
74
+ require_paths:
75
+ - lib
76
+ required_ruby_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - '>='
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ required_rubygems_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ requirements: []
87
+ rubyforge_project:
88
+ rubygems_version: 2.0.2
89
+ signing_key:
90
+ specification_version: 4
91
+ summary: Memory and GC inspector
92
+ test_files: []