Ruby  2.5.0dev(2017-10-22revision60238)
probes_helper.h
Go to the documentation of this file.
1 #ifndef RUBY_PROBES_HELPER_H
2 #define RUBY_PROBES_HELPER_H
3 
4 #include "ruby/ruby.h"
5 #include "probes.h"
6 
8  const char *classname;
9  const char *methodname;
10  const char *filename;
11  int line_no;
12  volatile VALUE klass;
13  volatile VALUE name;
14 };
15 
17 
18 #define RUBY_DTRACE_METHOD_HOOK(name, th, klazz, id) \
19 do { \
20  if (UNLIKELY(RUBY_DTRACE_##name##_ENABLED())) { \
21  struct ruby_dtrace_method_hook_args args; \
22  if (ruby_th_dtrace_setup(th, klazz, id, &args)) { \
23  RUBY_DTRACE_##name(args.classname, \
24  args.methodname, \
25  args.filename, \
26  args.line_no); \
27  } \
28  } \
29 } while (0)
30 
31 #define RUBY_DTRACE_METHOD_ENTRY_HOOK(th, klass, id) \
32  RUBY_DTRACE_METHOD_HOOK(METHOD_ENTRY, th, klass, id)
33 
34 #define RUBY_DTRACE_METHOD_RETURN_HOOK(th, klass, id) \
35  RUBY_DTRACE_METHOD_HOOK(METHOD_RETURN, th, klass, id)
36 
37 #define RUBY_DTRACE_CMETHOD_ENTRY_HOOK(th, klass, id) \
38  RUBY_DTRACE_METHOD_HOOK(CMETHOD_ENTRY, th, klass, id)
39 
40 #define RUBY_DTRACE_CMETHOD_RETURN_HOOK(th, klass, id) \
41  RUBY_DTRACE_METHOD_HOOK(CMETHOD_RETURN, th, klass, id)
42 
43 #endif /* RUBY_PROBES_HELPER_H */
unsigned long ID
Definition: ruby.h:86
unsigned long VALUE
Definition: ruby.h:85
NOINLINE(int ruby_th_dtrace_setup(rb_thread_t *, VALUE, ID, struct ruby_dtrace_method_hook_args *))
int ruby_th_dtrace_setup(rb_thread_t *th, VALUE klass, ID id, struct ruby_dtrace_method_hook_args *args)
Definition: vm.c:338