dtrace_probe_simple 0.1.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +23 -0
- data/README.md +71 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/dtrace_probe_simple.gemspec +28 -0
- data/ext/dtrace_probe_simple/dtrace_probe_simple.c +21 -0
- data/ext/dtrace_probe_simple/dtrace_probe_simple.h +6 -0
- data/ext/dtrace_probe_simple/extconf.rb +5 -0
- data/lib/dtrace_probe_simple.rb +5 -0
- data/lib/dtrace_probe_simple/version.rb +3 -0
- metadata +98 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 321763e7e748a7f7fe276ea0cc5bfd85e736a5153bddb3b29ab1caa09a3b73b6
|
4
|
+
data.tar.gz: 3727009ea08f95dc4730ee9ec3db02015e77cde3ff7b0bf98b5ff791d33c6cdc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ec713bdeb4d9215a84e2e8fa6c6b46ce1109dd877d7863a20fe85dc7a0cab811fd672e9a2cbd1e77dc528c16c36473003eae39ff9f23decaca73fe0e1998cbc4
|
7
|
+
data.tar.gz: 5100488b7740166b34c4e43bc025ac07f998b69c4212c9bdb53e42fa2572e1c8790035def93a7a27f2cda380717ae8e5778e9504aafaf053999f9b28bde6ff20
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
dtrace_probe_simple (0.1.0.pre)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
rake (10.5.0)
|
10
|
+
rake-compiler (1.0.7)
|
11
|
+
rake
|
12
|
+
|
13
|
+
PLATFORMS
|
14
|
+
ruby
|
15
|
+
|
16
|
+
DEPENDENCIES
|
17
|
+
bundler (>= 1.6)
|
18
|
+
dtrace_probe_simple!
|
19
|
+
rake (~> 10.0)
|
20
|
+
rake-compiler
|
21
|
+
|
22
|
+
BUNDLED WITH
|
23
|
+
1.16.1
|
data/README.md
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
# DTraceProbeSimple
|
2
|
+
|
3
|
+
A PoC to include `DTRACE_PROBE*` in Ruby.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
This is only available in Linux for now. Please install `systemtap-sdt-dev` (or alternatives) first.
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'dtrace_probe_simple'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install dtrace_probe_simple
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
puts $$
|
27
|
+
require "dtrace_probe_simple"
|
28
|
+
self.extend DtraceProbeSimple
|
29
|
+
|
30
|
+
loop do
|
31
|
+
probe(Object.new.inspect)
|
32
|
+
print "."
|
33
|
+
sleep 1
|
34
|
+
end
|
35
|
+
```
|
36
|
+
|
37
|
+
```console
|
38
|
+
$ ruby probe.rb
|
39
|
+
9806
|
40
|
+
.....
|
41
|
+
```
|
42
|
+
|
43
|
+
Now that USDT<ruby::ruby-probe> is available. You can get data from eBPF/BCC tools such as [mruby-bcc](https://github.com/udzura/mruby-bcc).
|
44
|
+
|
45
|
+
```console
|
46
|
+
$ sudo ./mruby/bin/mruby usdt_str.rb 9806
|
47
|
+
TIME(s) COMM PID ruby-probe
|
48
|
+
10423.001144000 ruby 9806 #<Object:0x000056054df498b0>
|
49
|
+
10424.006953000 ruby 9806 #<Object:0x000056054df497e8>
|
50
|
+
10425.006879000 ruby 9806 #<Object:0x000056054df49720>
|
51
|
+
10426.007019000 ruby 9806 #<Object:0x000056054df49608>
|
52
|
+
10427.006803000 ruby 9806 #<Object:0x000056054df494f0>
|
53
|
+
10428.007604000 ruby 9806 #<Object:0x000056054df49428>
|
54
|
+
10429.016610000 ruby 9806 #<Object:0x000056054df49360>
|
55
|
+
10430.017376000 ruby 9806 #<Object:0x000056054df49298>
|
56
|
+
10431.017446000 ruby 9806 #<Object:0x000056054df491d0>
|
57
|
+
10432.017105000 ruby 9806 #<Object:0x000056054df490b8>
|
58
|
+
10433.017682000 ruby 9806 #<Object:0x000056054df48ff0>
|
59
|
+
10434.017423000 ruby 9806 #<Object:0x000056054df48f28>
|
60
|
+
10435.019250000 ruby 9806 #<Object:0x000056054df48e38>
|
61
|
+
```
|
62
|
+
|
63
|
+
## Development
|
64
|
+
|
65
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
66
|
+
|
67
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
68
|
+
|
69
|
+
## Contributing
|
70
|
+
|
71
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/udzura/dtrace_probe_simple.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "dtrace_probe_simple"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "dtrace_probe_simple/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "dtrace_probe_simple"
|
7
|
+
spec.version = DTraceProbeSimple::VERSION
|
8
|
+
spec.authors = ["Uchio Kondo"]
|
9
|
+
spec.email = ["udzura@udzura.jp"]
|
10
|
+
|
11
|
+
spec.summary = %q{A PoC to include DTRACE_PROBE in Ruby.}
|
12
|
+
spec.description = %q{A PoC to include DTRACE_PROBE in Ruby.}
|
13
|
+
spec.homepage = "https://github.com/udzura/dtrace_probe_simple"
|
14
|
+
|
15
|
+
# Specify which files should be added to the gem when it is released.
|
16
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
17
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
18
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
|
+
end
|
20
|
+
# spec.bindir = "exe"
|
21
|
+
# spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
spec.extensions = ["ext/dtrace_probe_simple/extconf.rb"]
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", ">= 1.6"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
spec.add_development_dependency "rake-compiler"
|
28
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#include <sys/sdt.h>
|
2
|
+
#include "dtrace_probe_simple.h"
|
3
|
+
|
4
|
+
static VALUE
|
5
|
+
rb_do_probe_simple (VALUE mod, VALUE arg0) {
|
6
|
+
if(FIXNUM_P(arg0)) {
|
7
|
+
DTRACE_PROBE1(ruby-probe, ruby, NUM2LONG(arg0));
|
8
|
+
} else {
|
9
|
+
DTRACE_PROBE1(ruby-probe, ruby, StringValuePtr(arg0));
|
10
|
+
}
|
11
|
+
return arg0;
|
12
|
+
}
|
13
|
+
|
14
|
+
void
|
15
|
+
Init_dtrace_probe_simple(void)
|
16
|
+
{
|
17
|
+
VALUE rb_mDtraceProbeSimple;
|
18
|
+
|
19
|
+
rb_mDtraceProbeSimple = rb_define_module("DTraceProbeSimple");
|
20
|
+
rb_define_module_function(rb_mDtraceProbeSimple, "probe", rb_do_probe_simple, 1);
|
21
|
+
}
|
metadata
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dtrace_probe_simple
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0.pre
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Uchio Kondo
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-07-23 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.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
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.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.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'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: A PoC to include DTRACE_PROBE in Ruby.
|
56
|
+
email:
|
57
|
+
- udzura@udzura.jp
|
58
|
+
executables: []
|
59
|
+
extensions:
|
60
|
+
- ext/dtrace_probe_simple/extconf.rb
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- Gemfile
|
65
|
+
- Gemfile.lock
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- bin/console
|
69
|
+
- bin/setup
|
70
|
+
- dtrace_probe_simple.gemspec
|
71
|
+
- ext/dtrace_probe_simple/dtrace_probe_simple.c
|
72
|
+
- ext/dtrace_probe_simple/dtrace_probe_simple.h
|
73
|
+
- ext/dtrace_probe_simple/extconf.rb
|
74
|
+
- lib/dtrace_probe_simple.rb
|
75
|
+
- lib/dtrace_probe_simple/version.rb
|
76
|
+
homepage: https://github.com/udzura/dtrace_probe_simple
|
77
|
+
licenses: []
|
78
|
+
metadata: {}
|
79
|
+
post_install_message:
|
80
|
+
rdoc_options: []
|
81
|
+
require_paths:
|
82
|
+
- lib
|
83
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">"
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: 1.3.1
|
93
|
+
requirements: []
|
94
|
+
rubygems_version: 3.0.4
|
95
|
+
signing_key:
|
96
|
+
specification_version: 4
|
97
|
+
summary: A PoC to include DTRACE_PROBE in Ruby.
|
98
|
+
test_files: []
|