ruby-usdt 0.1.2 → 0.2.0
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.
- checksums.yaml +7 -0
- data/README.md +52 -34
- data/ext/usdt/test.rb +20 -3
- data/ext/usdt/usdt.c +46 -0
- data/lib/usdt/version.rb +1 -1
- metadata +8 -26
- data/ext/libusdt/LICENCE +0 -21
- data/ext/libusdt/Makefile +0 -148
- data/ext/libusdt/README.md +0 -81
- data/ext/libusdt/test.pl +0 -112
- data/ext/libusdt/test_mem_usage.c +0 -77
- data/ext/libusdt/test_usdt.c +0 -87
- data/ext/libusdt/usdt.c +0 -296
- data/ext/libusdt/usdt.h +0 -66
- data/ext/libusdt/usdt_dof.c +0 -128
- data/ext/libusdt/usdt_dof_file.c +0 -277
- data/ext/libusdt/usdt_dof_sections.c +0 -190
- data/ext/libusdt/usdt_internal.h +0 -95
- data/ext/libusdt/usdt_probe.c +0 -74
- data/ext/libusdt/usdt_tracepoints_i386.s +0 -69
- data/ext/libusdt/usdt_tracepoints_x86_64.s +0 -123
- data/ext/usdt/Makefile +0 -213
- data/ext/usdt/usdt.h +0 -57
@@ -1,123 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright (c) 2012, Chris Andrews. All rights reserved.
|
3
|
-
*/
|
4
|
-
|
5
|
-
/*
|
6
|
-
* Stub functions containing DTrace tracepoints for probes and
|
7
|
-
* is-enabled probes. These functions are copied for each probe
|
8
|
-
* dynamically created.
|
9
|
-
*
|
10
|
-
*/
|
11
|
-
.text
|
12
|
-
|
13
|
-
.align 4, 0x90
|
14
|
-
.globl usdt_tracepoint_isenabled
|
15
|
-
.globl _usdt_tracepoint_isenabled
|
16
|
-
.globl usdt_tracepoint_probe
|
17
|
-
.globl _usdt_tracepoint_probe
|
18
|
-
.globl usdt_tracepoint_end
|
19
|
-
.globl _usdt_tracepoint_end
|
20
|
-
.globl usdt_probe_args
|
21
|
-
.globl _usdt_probe_args
|
22
|
-
|
23
|
-
usdt_tracepoint_isenabled:
|
24
|
-
_usdt_tracepoint_isenabled:
|
25
|
-
pushq %rbp
|
26
|
-
movq %rsp, %rbp
|
27
|
-
addq $1, %rax
|
28
|
-
xorq %rax, %rax
|
29
|
-
nop
|
30
|
-
nop
|
31
|
-
leave
|
32
|
-
ret
|
33
|
-
usdt_tracepoint_probe:
|
34
|
-
_usdt_tracepoint_probe:
|
35
|
-
nop
|
36
|
-
nop
|
37
|
-
nop
|
38
|
-
nop
|
39
|
-
nop
|
40
|
-
addq %r14,%rsp
|
41
|
-
popq %rbx
|
42
|
-
popq %r14
|
43
|
-
popq %r13
|
44
|
-
popq %r12
|
45
|
-
leave
|
46
|
-
usdt_tracepoint_end:
|
47
|
-
_usdt_tracepoint_end:
|
48
|
-
ret
|
49
|
-
|
50
|
-
/*
|
51
|
-
* Probe argument marshalling, x86_64 style
|
52
|
-
*
|
53
|
-
*/
|
54
|
-
|
55
|
-
usdt_probe_args:
|
56
|
-
_usdt_probe_args:
|
57
|
-
pushq %rbp
|
58
|
-
movq %rsp,%rbp
|
59
|
-
pushq %r12
|
60
|
-
pushq %r13
|
61
|
-
pushq %r14
|
62
|
-
pushq %rbx
|
63
|
-
|
64
|
-
movq %rdi,%r12
|
65
|
-
movq %rsi,%rbx
|
66
|
-
movq %rdx,%r11
|
67
|
-
movq $0,%r14
|
68
|
-
|
69
|
-
test %rbx,%rbx
|
70
|
-
je fire
|
71
|
-
movq (%r11),%rdi
|
72
|
-
dec %rbx
|
73
|
-
test %rbx,%rbx
|
74
|
-
je fire
|
75
|
-
addq $8,%r11
|
76
|
-
movq (%r11),%rsi
|
77
|
-
dec %rbx
|
78
|
-
test %rbx,%rbx
|
79
|
-
je fire
|
80
|
-
addq $8,%r11
|
81
|
-
movq (%r11),%rdx
|
82
|
-
dec %rbx
|
83
|
-
test %rbx,%rbx
|
84
|
-
je fire
|
85
|
-
addq $8,%r11
|
86
|
-
movq (%r11),%rcx
|
87
|
-
dec %rbx
|
88
|
-
test %rbx,%rbx
|
89
|
-
je fire
|
90
|
-
addq $8,%r11
|
91
|
-
movq (%r11),%r8
|
92
|
-
dec %rbx
|
93
|
-
test %rbx,%rbx
|
94
|
-
je fire
|
95
|
-
addq $8,%r11
|
96
|
-
movq (%r11),%r9
|
97
|
-
|
98
|
-
movq %rbx,%r13
|
99
|
-
morestack:
|
100
|
-
dec %rbx
|
101
|
-
test %rbx,%rbx
|
102
|
-
je args
|
103
|
-
subq $16,%rsp
|
104
|
-
addq $16,%r14
|
105
|
-
dec %rbx
|
106
|
-
test %rbx,%rbx
|
107
|
-
je args
|
108
|
-
jmp morestack
|
109
|
-
|
110
|
-
args:
|
111
|
-
movq %r13,%rbx
|
112
|
-
movq $0,%r13
|
113
|
-
moreargs:
|
114
|
-
dec %rbx
|
115
|
-
test %rbx,%rbx
|
116
|
-
je fire
|
117
|
-
addq $8,%r11
|
118
|
-
movq (%r11),%rax
|
119
|
-
movq %rax,(%rsp,%r13)
|
120
|
-
addq $8,%r13
|
121
|
-
jmp moreargs
|
122
|
-
|
123
|
-
fire: jmp *%r12
|
data/ext/usdt/Makefile
DELETED
@@ -1,213 +0,0 @@
|
|
1
|
-
|
2
|
-
SHELL = /bin/sh
|
3
|
-
|
4
|
-
# V=0 quiet, V=1 verbose. other values don't work.
|
5
|
-
V = 0
|
6
|
-
Q1 = $(V:1=)
|
7
|
-
Q = $(Q1:0=@)
|
8
|
-
n=$(NULLCMD)
|
9
|
-
ECHO1 = $(V:1=@$n)
|
10
|
-
ECHO = $(ECHO1:0=@echo)
|
11
|
-
|
12
|
-
#### Start of system configuration section. ####
|
13
|
-
|
14
|
-
srcdir = .
|
15
|
-
topdir = /Users/kevin/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1
|
16
|
-
hdrdir = /Users/kevin/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1
|
17
|
-
arch_hdrdir = /Users/kevin/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1/$(arch)
|
18
|
-
VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
|
19
|
-
prefix = $(DESTDIR)/Users/kevin/.rvm/rubies/ruby-1.9.3-p125
|
20
|
-
rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
|
21
|
-
exec_prefix = $(prefix)
|
22
|
-
vendorhdrdir = $(rubyhdrdir)/vendor_ruby
|
23
|
-
sitehdrdir = $(rubyhdrdir)/site_ruby
|
24
|
-
rubyhdrdir = $(includedir)/$(RUBY_BASE_NAME)-$(ruby_version)
|
25
|
-
vendordir = $(rubylibprefix)/vendor_ruby
|
26
|
-
sitedir = $(rubylibprefix)/site_ruby
|
27
|
-
ridir = $(datarootdir)/$(RI_BASE_NAME)
|
28
|
-
mandir = $(datarootdir)/man
|
29
|
-
localedir = $(datarootdir)/locale
|
30
|
-
libdir = $(exec_prefix)/lib
|
31
|
-
psdir = $(docdir)
|
32
|
-
pdfdir = $(docdir)
|
33
|
-
dvidir = $(docdir)
|
34
|
-
htmldir = $(docdir)
|
35
|
-
infodir = $(datarootdir)/info
|
36
|
-
docdir = $(datarootdir)/doc/$(PACKAGE)
|
37
|
-
oldincludedir = $(DESTDIR)/usr/include
|
38
|
-
includedir = $(prefix)/include
|
39
|
-
localstatedir = $(prefix)/var
|
40
|
-
sharedstatedir = $(prefix)/com
|
41
|
-
sysconfdir = $(prefix)/etc
|
42
|
-
datadir = $(datarootdir)
|
43
|
-
datarootdir = $(prefix)/share
|
44
|
-
libexecdir = $(exec_prefix)/libexec
|
45
|
-
sbindir = $(exec_prefix)/sbin
|
46
|
-
bindir = $(exec_prefix)/bin
|
47
|
-
rubylibdir = $(rubylibprefix)/$(ruby_version)
|
48
|
-
archdir = $(rubylibdir)/$(arch)
|
49
|
-
sitelibdir = $(sitedir)/$(ruby_version)
|
50
|
-
sitearchdir = $(sitelibdir)/$(sitearch)
|
51
|
-
vendorlibdir = $(vendordir)/$(ruby_version)
|
52
|
-
vendorarchdir = $(vendorlibdir)/$(sitearch)
|
53
|
-
|
54
|
-
NULLCMD = :
|
55
|
-
|
56
|
-
CC = /usr/bin/gcc-4.2
|
57
|
-
CXX = g++-4.2
|
58
|
-
LIBRUBY = $(LIBRUBY_SO)
|
59
|
-
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
60
|
-
LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
|
61
|
-
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
|
62
|
-
OUTFLAG = -o
|
63
|
-
COUTFLAG = -o
|
64
|
-
|
65
|
-
RUBY_EXTCONF_H =
|
66
|
-
cflags = $(optflags) $(debugflags) $(warnflags)
|
67
|
-
optflags = -O3
|
68
|
-
debugflags = -ggdb
|
69
|
-
warnflags = -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration
|
70
|
-
CFLAGS = -fno-common $(cflags) -fno-common -pipe $(ARCH_FLAG)
|
71
|
-
INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
|
72
|
-
DEFS =
|
73
|
-
CPPFLAGS = -DHAVE_USDT_H -I/Users/kevin/.rvm/usr/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE $(DEFS) $(cppflags)
|
74
|
-
CXXFLAGS = $(CFLAGS) $(cxxflags)
|
75
|
-
ldflags = -L. -L/usr/local/lib
|
76
|
-
dldflags = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace
|
77
|
-
ARCH_FLAG =
|
78
|
-
DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
|
79
|
-
LDSHARED = $(CC) -dynamic -bundle
|
80
|
-
LDSHAREDXX = $(CXX) -dynamic -bundle
|
81
|
-
AR = ar
|
82
|
-
EXEEXT =
|
83
|
-
|
84
|
-
RUBY_BASE_NAME = ruby
|
85
|
-
RUBY_INSTALL_NAME = ruby
|
86
|
-
RUBY_SO_NAME = ruby.1.9.1
|
87
|
-
arch = x86_64-darwin11.3.0
|
88
|
-
sitearch = $(arch)
|
89
|
-
ruby_version = 1.9.1
|
90
|
-
ruby = /Users/kevin/.rvm/rubies/ruby-1.9.3-p125/bin/ruby
|
91
|
-
RUBY = $(ruby)
|
92
|
-
RM = rm -f
|
93
|
-
RM_RF = $(RUBY) -run -e rm -- -rf
|
94
|
-
RMDIRS = rmdir -p
|
95
|
-
MAKEDIRS = mkdir -p
|
96
|
-
INSTALL = /usr/bin/install -c
|
97
|
-
INSTALL_PROG = $(INSTALL) -m 0755
|
98
|
-
INSTALL_DATA = $(INSTALL) -m 644
|
99
|
-
COPY = cp
|
100
|
-
|
101
|
-
#### End of system configuration section. ####
|
102
|
-
|
103
|
-
preload =
|
104
|
-
|
105
|
-
libpath = . $(libdir) /Users/kevin/.rvm/usr/lib
|
106
|
-
LIBPATH = -L. -L$(libdir) -L/Users/kevin/.rvm/usr/lib
|
107
|
-
DEFFILE =
|
108
|
-
|
109
|
-
CLEANFILES = mkmf.log
|
110
|
-
DISTCLEANFILES =
|
111
|
-
DISTCLEANDIRS =
|
112
|
-
|
113
|
-
extout =
|
114
|
-
extout_prefix =
|
115
|
-
target_prefix =
|
116
|
-
LOCAL_LIBS =
|
117
|
-
LIBS = $(LIBRUBYARG_SHARED) -lusdt -ldtrace -lpthread -ldl -lobjc
|
118
|
-
SRCS = usdt.c
|
119
|
-
OBJS = usdt.o
|
120
|
-
TARGET = usdt
|
121
|
-
DLLIB = $(TARGET).bundle
|
122
|
-
EXTSTATIC =
|
123
|
-
STATIC_LIB =
|
124
|
-
|
125
|
-
BINDIR = $(bindir)
|
126
|
-
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
|
127
|
-
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
|
128
|
-
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
129
|
-
HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
|
130
|
-
ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
|
131
|
-
|
132
|
-
TARGET_SO = $(DLLIB)
|
133
|
-
CLEANLIBS = $(TARGET).bundle
|
134
|
-
CLEANOBJS = *.o *.bak
|
135
|
-
|
136
|
-
all: $(DLLIB)
|
137
|
-
static: $(STATIC_LIB)
|
138
|
-
.PHONY: all install static install-so install-rb
|
139
|
-
.PHONY: clean clean-so clean-rb
|
140
|
-
|
141
|
-
clean-rb-default::
|
142
|
-
clean-rb::
|
143
|
-
clean-so::
|
144
|
-
clean: clean-so clean-rb-default clean-rb
|
145
|
-
@-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
|
146
|
-
|
147
|
-
distclean-rb-default::
|
148
|
-
distclean-rb::
|
149
|
-
distclean-so::
|
150
|
-
distclean: clean distclean-so distclean-rb-default distclean-rb
|
151
|
-
@-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
|
152
|
-
@-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
|
153
|
-
@-$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
|
154
|
-
|
155
|
-
realclean: distclean
|
156
|
-
install: install-so install-rb
|
157
|
-
|
158
|
-
install-so: $(RUBYARCHDIR)
|
159
|
-
install-so: $(RUBYARCHDIR)/$(DLLIB)
|
160
|
-
$(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
|
161
|
-
@-$(MAKEDIRS) $(@D)
|
162
|
-
$(INSTALL_PROG) $(DLLIB) $(@D)
|
163
|
-
install-rb: pre-install-rb install-rb-default
|
164
|
-
install-rb-default: pre-install-rb-default
|
165
|
-
pre-install-rb: Makefile
|
166
|
-
pre-install-rb-default: Makefile
|
167
|
-
pre-install-rb-default:
|
168
|
-
$(ECHO) installing default usdt libraries
|
169
|
-
$(RUBYARCHDIR):
|
170
|
-
$(Q) $(MAKEDIRS) $@
|
171
|
-
|
172
|
-
site-install: site-install-so site-install-rb
|
173
|
-
site-install-so: install-so
|
174
|
-
site-install-rb: install-rb
|
175
|
-
|
176
|
-
.SUFFIXES: .c .m .cc .mm .cxx .cpp .C .o
|
177
|
-
|
178
|
-
.cc.o:
|
179
|
-
$(ECHO) compiling $(<)
|
180
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
181
|
-
|
182
|
-
.mm.o:
|
183
|
-
$(ECHO) compiling $(<)
|
184
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
185
|
-
|
186
|
-
.cxx.o:
|
187
|
-
$(ECHO) compiling $(<)
|
188
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
189
|
-
|
190
|
-
.cpp.o:
|
191
|
-
$(ECHO) compiling $(<)
|
192
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
193
|
-
|
194
|
-
.C.o:
|
195
|
-
$(ECHO) compiling $(<)
|
196
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
197
|
-
|
198
|
-
.c.o:
|
199
|
-
$(ECHO) compiling $(<)
|
200
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
|
201
|
-
|
202
|
-
.m.o:
|
203
|
-
$(ECHO) compiling $(<)
|
204
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
|
205
|
-
|
206
|
-
$(DLLIB): $(OBJS) Makefile
|
207
|
-
$(ECHO) linking shared-object $(DLLIB)
|
208
|
-
@-$(RM) $(@)
|
209
|
-
$(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
$(OBJS): $(hdrdir)/ruby.h $(hdrdir)/ruby/defines.h $(arch_hdrdir)/ruby/config.h
|
data/ext/usdt/usdt.h
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright (c) 2012, Chris Andrews. All rights reserved.
|
3
|
-
*/
|
4
|
-
|
5
|
-
#include <stdint.h>
|
6
|
-
#include <unistd.h>
|
7
|
-
|
8
|
-
typedef uint8_t usdt_argtype_t;
|
9
|
-
#define USDT_ARGTYPE_NONE 0
|
10
|
-
#define USDT_ARGTYPE_STRING 1
|
11
|
-
#define USDT_ARGTYPE_INTEGER 2
|
12
|
-
|
13
|
-
#define USDT_ARG_MAX 32
|
14
|
-
|
15
|
-
typedef enum usdt_error {
|
16
|
-
USDT_ERROR_MALLOC = 0,
|
17
|
-
USDT_ERROR_VALLOC,
|
18
|
-
USDT_ERROR_NOPROBES,
|
19
|
-
USDT_ERROR_LOADDOF,
|
20
|
-
USDT_ERROR_ALREADYENABLED
|
21
|
-
} usdt_error_t;
|
22
|
-
|
23
|
-
typedef struct usdt_probe {
|
24
|
-
int (*isenabled_addr)(void);
|
25
|
-
void *probe_addr;
|
26
|
-
} usdt_probe_t;
|
27
|
-
|
28
|
-
int usdt_is_enabled(usdt_probe_t *probe);
|
29
|
-
void usdt_fire_probe(usdt_probe_t *probe, size_t argc, void **argv);
|
30
|
-
|
31
|
-
typedef struct usdt_probedef {
|
32
|
-
const char *name;
|
33
|
-
const char *function;
|
34
|
-
size_t argc;
|
35
|
-
usdt_argtype_t types[USDT_ARG_MAX];
|
36
|
-
struct usdt_probe *probe;
|
37
|
-
struct usdt_probedef *next;
|
38
|
-
} usdt_probedef_t;
|
39
|
-
|
40
|
-
usdt_probedef_t *usdt_create_probe(const char *func, const char *name,
|
41
|
-
size_t argc, const char **types);
|
42
|
-
|
43
|
-
typedef struct usdt_provider {
|
44
|
-
const char *name;
|
45
|
-
const char *module;
|
46
|
-
usdt_probedef_t *probedefs;
|
47
|
-
char *error;
|
48
|
-
int enabled;
|
49
|
-
} usdt_provider_t;
|
50
|
-
|
51
|
-
usdt_provider_t *usdt_create_provider(const char *name, const char *module);
|
52
|
-
void usdt_provider_add_probe(usdt_provider_t *provider, usdt_probedef_t *probedef);
|
53
|
-
int usdt_provider_enable(usdt_provider_t *provider);
|
54
|
-
|
55
|
-
void usdt_error(usdt_provider_t *provider, usdt_error_t error, ...);
|
56
|
-
char *usdt_errstr(usdt_provider_t *provider);
|
57
|
-
|