ruby-usdt 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -26,7 +26,7 @@ providers at runtime for instrumentation and analysis by the DTrace
26
26
  # args must be either :integer, or :string
27
27
  # max 6 args (dtrace provides this many), additional args will be ignored
28
28
  # returns USDT::Probe object
29
- p = provider.probe("myfn", "probe", :string, :string, :integer)
29
+ p = provider.probe(:myfn, :probe, :string, :string, :integer)
30
30
 
31
31
  # Provider#enable
32
32
  # enables the probes defined with #probe
data/ext/usdt/Makefile CHANGED
@@ -4,67 +4,81 @@ SHELL = /bin/sh
4
4
  #### Start of system configuration section. ####
5
5
 
6
6
  srcdir = .
7
- topdir = /Users/kevin/.rvm/rubies/ruby-1.8.7-p358/lib/ruby/1.8/i686-darwin11.3.0
8
- hdrdir = $(topdir)
9
- VPATH = $(srcdir):$(topdir):$(hdrdir)
10
- prefix = $(DESTDIR)/Users/kevin/.rvm/rubies/ruby-1.8.7-p358
7
+ topdir = /Users/kevin/.rvm/rubies/ruby-1.9.1-p378/include/ruby-1.9.1
8
+ hdrdir = /Users/kevin/.rvm/rubies/ruby-1.9.1-p378/include/ruby-1.9.1
9
+ arch_hdrdir = /Users/kevin/.rvm/rubies/ruby-1.9.1-p378/include/ruby-1.9.1/$(arch)
10
+ VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
11
+ prefix = $(DESTDIR)/Users/kevin/.rvm/rubies/ruby-1.9.1-p378
11
12
  exec_prefix = $(prefix)
12
- htmldir = $(docdir)
13
- vendorarchdir = $(vendorlibdir)/$(sitearch)
14
- sitedir = $(libdir)/ruby/site_ruby
13
+ vendorhdrdir = $(rubyhdrdir)/vendor_ruby
14
+ sitehdrdir = $(rubyhdrdir)/site_ruby
15
+ rubyhdrdir = $(includedir)/$(RUBY_INSTALL_NAME)-$(ruby_version)
16
+ vendordir = $(libdir)/$(RUBY_INSTALL_NAME)/vendor_ruby
17
+ sitedir = $(libdir)/$(RUBY_INSTALL_NAME)/site_ruby
18
+ mandir = $(datarootdir)/man
19
+ localedir = $(datarootdir)/locale
20
+ libdir = $(exec_prefix)/lib
21
+ psdir = $(docdir)
15
22
  pdfdir = $(docdir)
16
23
  dvidir = $(docdir)
24
+ htmldir = $(docdir)
25
+ infodir = $(datarootdir)/info
26
+ docdir = $(datarootdir)/doc/$(PACKAGE)
27
+ oldincludedir = $(DESTDIR)/usr/include
28
+ includedir = $(prefix)/include
29
+ localstatedir = $(prefix)/var
17
30
  sharedstatedir = $(prefix)/com
18
- vendordir = $(libdir)/ruby/vendor_ruby
19
- psdir = $(docdir)
20
- libexecdir = $(exec_prefix)/libexec
31
+ sysconfdir = $(prefix)/etc
32
+ datadir = $(datarootdir)
21
33
  datarootdir = $(prefix)/share
34
+ libexecdir = $(exec_prefix)/libexec
35
+ sbindir = $(exec_prefix)/sbin
22
36
  bindir = $(exec_prefix)/bin
23
- infodir = $(datarootdir)/info
24
- sitearchdir = $(sitelibdir)/$(sitearch)
25
- sysconfdir = $(prefix)/etc
37
+ rubylibdir = $(libdir)/$(ruby_install_name)/$(ruby_version)
26
38
  archdir = $(rubylibdir)/$(arch)
27
- sbindir = $(exec_prefix)/sbin
28
- includedir = $(prefix)/include
29
- mandir = $(datarootdir)/man
30
- rubylibdir = $(libdir)/ruby/$(ruby_version)
31
- localstatedir = $(prefix)/var
32
- vendorlibdir = $(vendordir)/$(ruby_version)
33
39
  sitelibdir = $(sitedir)/$(ruby_version)
34
- docdir = $(datarootdir)/doc/$(PACKAGE)
35
- datadir = $(datarootdir)
36
- localedir = $(datarootdir)/locale
37
- libdir = $(exec_prefix)/lib
38
- oldincludedir = $(DESTDIR)/usr/include
40
+ sitearchdir = $(sitelibdir)/$(sitearch)
41
+ vendorlibdir = $(vendordir)/$(ruby_version)
42
+ vendorarchdir = $(vendorlibdir)/$(sitearch)
39
43
 
40
- CC = /usr/bin/gcc-4.2
41
- LIBRUBY = $(LIBRUBY_SO)
44
+ CC = gcc
45
+ CXX = g++
46
+ LIBRUBY = $(LIBRUBY_A)
42
47
  LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
43
48
  LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
44
49
  LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
50
+ OUTFLAG = -o
51
+ COUTFLAG = -o
45
52
 
46
53
  RUBY_EXTCONF_H =
47
- CFLAGS = -fno-common -g -O2 -fno-common -pipe -fno-common $(cflags)
48
- INCFLAGS = -I. -I. -I/Users/kevin/.rvm/rubies/ruby-1.8.7-p358/lib/ruby/1.8/i686-darwin11.3.0 -I.
54
+ cflags = $(optflags) $(debugflags) $(warnflags)
55
+ optflags = -O2
56
+ debugflags = -g
57
+ warnflags = -Wall -Wno-parentheses
58
+ CFLAGS = -fno-common $(cflags) -pipe -fno-common
59
+ INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
49
60
  DEFS =
50
- CPPFLAGS = -DHAVE_USDT_H -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE
51
- CXXFLAGS = $(CFLAGS)
61
+ CPPFLAGS = -DHAVE_USDT_H -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE $(DEFS) $(cppflags)
62
+ CXXFLAGS = $(CFLAGS) $(cxxflags)
52
63
  ldflags = -L.
53
64
  dldflags =
54
65
  archflag =
55
66
  DLDFLAGS = $(ldflags) $(dldflags) $(archflag)
56
67
  LDSHARED = cc -dynamic -bundle -undefined suppress -flat_namespace
68
+ LDSHAREDXX = $(LDSHARED)
57
69
  AR = ar
58
70
  EXEEXT =
59
71
 
60
72
  RUBY_INSTALL_NAME = ruby
61
73
  RUBY_SO_NAME = ruby
62
- arch = i686-darwin11.3.0
63
- sitearch = i686-darwin11.3.0
64
- ruby_version = 1.8
65
- ruby = /Users/kevin/.rvm/rubies/ruby-1.8.7-p358/bin/ruby
74
+ arch = i386-darwin10.3.0
75
+ sitearch = i386-darwin10.3.0
76
+ ruby_version = 1.9.1
77
+ ruby = /Users/kevin/.rvm/rubies/ruby-1.9.1-p378/bin/ruby
66
78
  RUBY = $(ruby)
67
79
  RM = rm -f
80
+ RM_RF = $(RUBY) -run -e rm -- -rf
81
+ RMDIRS = $(RUBY) -run -e rmdir -- -p
68
82
  MAKEDIRS = mkdir -p
69
83
  INSTALL = /usr/bin/install -c
70
84
  INSTALL_PROG = $(INSTALL) -m 0755
@@ -81,12 +95,13 @@ DEFFILE =
81
95
 
82
96
  CLEANFILES = mkmf.log
83
97
  DISTCLEANFILES =
98
+ DISTCLEANDIRS =
84
99
 
85
100
  extout =
86
101
  extout_prefix =
87
102
  target_prefix =
88
103
  LOCAL_LIBS =
89
- LIBS = $(LIBRUBYARG_SHARED) -lusdt -ldtrace -ldl -lobjc
104
+ LIBS = -lusdt -ldtrace -lpthread -ldl -lobjc
90
105
  SRCS = usdt.c
91
106
  OBJS = usdt.o
92
107
  TARGET = usdt
@@ -98,22 +113,31 @@ BINDIR = $(bindir)
98
113
  RUBYCOMMONDIR = $(sitedir)$(target_prefix)
99
114
  RUBYLIBDIR = $(sitelibdir)$(target_prefix)
100
115
  RUBYARCHDIR = $(sitearchdir)$(target_prefix)
116
+ HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
117
+ ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
101
118
 
102
119
  TARGET_SO = $(DLLIB)
103
- CLEANLIBS = $(TARGET).bundle $(TARGET).il? $(TARGET).tds $(TARGET).map
104
- CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
120
+ CLEANLIBS = $(TARGET).bundle
121
+ CLEANOBJS = *.o *.bak
105
122
 
106
- all: $(DLLIB)
107
- static: $(STATIC_LIB)
123
+ all: $(DLLIB)
124
+ static: $(STATIC_LIB)
108
125
 
109
- clean:
126
+ clean-rb-default::
127
+ clean-rb::
128
+ clean-so::
129
+ clean: clean-so clean-rb-default clean-rb
110
130
  @-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
111
131
 
112
- distclean: clean
132
+ distclean-rb-default::
133
+ distclean-rb::
134
+ distclean-so::
135
+ distclean: clean distclean-so distclean-rb-default distclean-rb
113
136
  @-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
114
137
  @-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
138
+ @-$(RMDIRS) $(DISTCLEANDIRS)
115
139
 
116
- realclean: distclean
140
+ realclean: distclean
117
141
  install: install-so install-rb
118
142
 
119
143
  install-so: $(RUBYARCHDIR)
@@ -134,24 +158,24 @@ site-install-rb: install-rb
134
158
  .SUFFIXES: .c .m .cc .cxx .cpp .C .o
135
159
 
136
160
  .cc.o:
137
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
161
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
138
162
 
139
163
  .cxx.o:
140
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
164
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
141
165
 
142
166
  .cpp.o:
143
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
167
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
144
168
 
145
169
  .C.o:
146
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
170
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
147
171
 
148
172
  .c.o:
149
- $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) -c $<
173
+ $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
150
174
 
151
175
  $(DLLIB): $(OBJS) Makefile
152
- @-$(RM) $@
176
+ @-$(RM) $(@)
153
177
  $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
154
178
 
155
179
 
156
180
 
157
- $(OBJS): ruby.h defines.h
181
+ $(OBJS): $(hdrdir)/ruby.h $(hdrdir)/ruby/defines.h $(arch_hdrdir)/ruby/config.h
data/ext/usdt/test.rb CHANGED
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__)) + '/usdt'
2
2
 
3
3
  provider = USDT::Provider.create :ruby, :test
4
4
  puts provider
5
- p = provider.probe("myfn", "probe",
5
+ p = provider.probe(:myfn, :probe,
6
6
  :string, :string, :integer)
7
7
 
8
8
  provider.enable
data/ext/usdt/usdt.c CHANGED
@@ -34,8 +34,8 @@ static VALUE provider_create(VALUE self, VALUE name, VALUE mod) {
34
34
  Check_Type(name, T_SYMBOL);
35
35
  Check_Type(mod, T_SYMBOL);
36
36
 
37
- char *namestr = rb_id2name(rb_to_id(name));
38
- char *modstr = rb_id2name(rb_to_id(mod));
37
+ const char *namestr = rb_id2name(rb_to_id(name));
38
+ const char *modstr = rb_id2name(rb_to_id(mod));
39
39
 
40
40
  usdt_provider_t* p = usdt_create_provider(namestr, modstr);
41
41
 
@@ -52,8 +52,8 @@ static VALUE provider_create(VALUE self, VALUE name, VALUE mod) {
52
52
  * USDT::Provider#probe(func, name, pargs*)
53
53
  */
54
54
  static VALUE provider_probe(int argc, VALUE *argv, VALUE self) {
55
- const char *func = RSTRING_PTR(argv[0]);
56
- const char *name = RSTRING_PTR(argv[1]);
55
+ const char *func = rb_id2name(rb_to_id(argv[0]));
56
+ const char *name = rb_id2name(rb_to_id(argv[1]));
57
57
  const char *types[6];
58
58
  size_t i, pargc = 0;
59
59
  size_t t_int = rb_intern("integer");
@@ -118,6 +118,10 @@ static VALUE probe_enabled(VALUE self) {
118
118
  * USDT::Probe#fire *args
119
119
  */
120
120
  static VALUE probe_fire(int argc, VALUE *argv, VALUE self) {
121
+ if (probe_enabled(self) == Qfalse) {
122
+ return Qfalse;
123
+ }
124
+
121
125
  usdt_probedef_t **p = DATA_PTR(self);
122
126
  usdt_probedef_t *probedef = *p;
123
127
 
data/lib/usdt/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module USDT
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-usdt
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kevin Chan
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-04-21 00:00:00 Z
18
+ date: 2012-04-24 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description:
@@ -43,8 +43,6 @@ files:
43
43
  - ext/libusdt/usdt_probe.c
44
44
  - ext/libusdt/usdt_tracepoints_i386.s
45
45
  - ext/libusdt/usdt_tracepoints_x86_64.s
46
- - ext/usdt/conftest.dSYM/Contents/Info.plist
47
- - ext/usdt/conftest.dSYM/Contents/Resources/DWARF/conftest
48
46
  - ext/usdt/extconf.rb
49
47
  - ext/usdt/Makefile
50
48
  - ext/usdt/test.rb
@@ -85,6 +83,6 @@ rubyforge_project:
85
83
  rubygems_version: 1.8.21
86
84
  signing_key:
87
85
  specification_version: 3
88
- summary: Native DTrace probes ruby apps
86
+ summary: Native DTrace probes for ruby.
89
87
  test_files: []
90
88
 
@@ -1,20 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>CFBundleDevelopmentRegion</key>
6
- <string>English</string>
7
- <key>CFBundleIdentifier</key>
8
- <string>com.apple.xcode.dsym.conftest</string>
9
- <key>CFBundleInfoDictionaryVersion</key>
10
- <string>6.0</string>
11
- <key>CFBundlePackageType</key>
12
- <string>dSYM</string>
13
- <key>CFBundleSignature</key>
14
- <string>????</string>
15
- <key>CFBundleShortVersionString</key>
16
- <string>1.0</string>
17
- <key>CFBundleVersion</key>
18
- <string>1</string>
19
- </dict>
20
- </plist>