ruby-static-tracing 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/ext/ruby-static-tracing/darwin/provider.c +40 -52
  3. data/ext/ruby-static-tracing/darwin/provider.h +2 -3
  4. data/ext/ruby-static-tracing/darwin/ruby_static_tracing.c +4 -5
  5. data/ext/ruby-static-tracing/darwin/tracepoint.c +66 -91
  6. data/ext/ruby-static-tracing/darwin/tracepoint.h +4 -4
  7. data/ext/ruby-static-tracing/extconf.rb +40 -36
  8. data/ext/ruby-static-tracing/include/ruby_static_tracing.h +2 -1
  9. data/ext/ruby-static-tracing/lib/deps-extconf.rb +30 -28
  10. data/ext/ruby-static-tracing/lib/post-extconf.rb +23 -21
  11. data/ext/ruby-static-tracing/linux/provider.c +87 -61
  12. data/ext/ruby-static-tracing/linux/provider.h +16 -4
  13. data/ext/ruby-static-tracing/linux/ruby_static_tracing.c +7 -7
  14. data/ext/ruby-static-tracing/linux/tracepoint.c +86 -96
  15. data/ext/ruby-static-tracing/linux/tracepoint.h +2 -2
  16. data/ext/ruby-static-tracing/linux/types.h +2 -2
  17. data/lib/ruby-static-tracing.rb +11 -3
  18. data/lib/ruby-static-tracing/configuration.rb +11 -0
  19. data/lib/ruby-static-tracing/platform.rb +5 -1
  20. data/lib/ruby-static-tracing/provider.rb +50 -26
  21. data/lib/ruby-static-tracing/tracepoint.rb +19 -9
  22. data/lib/ruby-static-tracing/tracepoints.rb +2 -0
  23. data/lib/ruby-static-tracing/tracer/base.rb +2 -0
  24. data/lib/ruby-static-tracing/tracer/concerns/latency_tracer.rb +2 -0
  25. data/lib/ruby-static-tracing/tracer/helpers.rb +8 -8
  26. data/lib/ruby-static-tracing/tracer/latency.rb +1 -1
  27. data/lib/ruby-static-tracing/tracer/stack.rb +4 -2
  28. data/lib/ruby-static-tracing/tracers.rb +9 -0
  29. data/lib/ruby-static-tracing/version.rb +2 -1
  30. metadata +42 -14
@@ -8,14 +8,14 @@
8
8
  // FIXME move this to shared header
9
9
  typedef union {
10
10
  unsigned long long intval;
11
- char * strval;
11
+ char *strval;
12
12
  } Tracepoint_fire_arg;
13
13
 
14
14
  typedef struct {
15
15
  char *name;
16
16
  usdt_probedef_t *usdt_tracepoint_def;
17
- usdt_probe_t *usdt_tracepoint;
18
- //Tracepoint_arg_types *args;
17
+ usdt_probe_t *usdt_tracepoint;
18
+ // Tracepoint_arg_types *args;
19
19
  } static_tracing_tracepoint_t;
20
20
 
21
21
  /*
@@ -49,4 +49,4 @@ tracepoint_enabled(VALUE self);
49
49
  VALUE
50
50
  static_tracing_tracepoint_alloc(VALUE klass);
51
51
 
52
- #endif //STATIC_TRACING_TRACEPOINT_H
52
+ #endif // STATIC_TRACING_TRACEPOINT_H
@@ -1,83 +1,87 @@
1
- $LOAD_PATH.unshift File.expand_path("../../../lib", __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.unshift File.expand_path('../../lib', __dir__).freeze
2
4
 
3
5
  require 'mkmf'
4
6
  require 'ruby-static-tracing/platform'
5
7
 
6
- BASE_DIR=File.expand_path(File.dirname(__FILE__))
7
- LIB_DIR = File.expand_path('../../../lib/ruby-static-tracing', __FILE__)
8
+ BASE_DIR = __dir__
9
+ LIB_DIR = File.expand_path('../../lib/ruby-static-tracing', __dir__)
8
10
 
9
- MKMF_TARGET='ruby-static-tracing/ruby_static_tracing'
11
+ MKMF_TARGET = 'ruby-static-tracing/ruby_static_tracing'
10
12
 
11
13
  def platform_dir(platform)
12
14
  File.expand_path("../../../ext/ruby-static-tracing/#{platform}/", __FILE__)
13
15
  end
14
16
 
15
17
  def lib_dir
16
- File.expand_path("../../../lib/ruby-static-tracing/", __FILE__)
18
+ File.expand_path('../../lib/ruby-static-tracing', __dir__)
17
19
  end
18
20
  # - Linux, via libstapsdt
19
21
  if StaticTracing::Platform.linux?
20
22
 
21
- LIB_DIRS = [LIB_DIR, RbConfig::CONFIG['libdir']]
23
+ LIB_DIRS = [LIB_DIR, RbConfig::CONFIG['libdir']].freeze
22
24
  HEADER_DIRS = [
23
- File.join(BASE_DIR, 'include'),
24
- File.join(BASE_DIR, 'lib', 'libstapsdt', 'src'),
25
- RbConfig::CONFIG['includedir']
26
- ]
25
+ File.join(BASE_DIR, 'include'),
26
+ File.join(BASE_DIR, 'lib', 'libstapsdt', 'src'),
27
+ RbConfig::CONFIG['includedir']
28
+ ].freeze
27
29
 
30
+ puts HEADER_DIRS.inspect
28
31
  dir_config(MKMF_TARGET, HEADER_DIRS, LIB_DIRS)
29
32
 
30
33
  abort 'libstapsdt.h is missing, please install libstapsdt' unless find_header('libstapsdt.h')
31
34
  have_header 'libstapsdt.h'
35
+ have_header 'ruby_static_tracing.h'
32
36
 
33
37
  unless have_library('stapsdt')
34
- abort "libstapsdt is missing, please install it"
38
+ abort 'libstapsdt is missing, please install it'
35
39
  end
36
40
 
37
- $CFLAGS = "-D_GNU_SOURCE -Wall " # -Werror complaining
38
- if ENV.key?('DEBUG')
39
- $CFLAGS << "-O0 -g -DDEBUG"
40
- else
41
- $CFLAGS << "-O3"
42
- end
41
+ $CFLAGS = '-D_GNU_SOURCE -Wall ' # -Werror complaining
42
+ $CFLAGS += if ENV.key?('DEBUG')
43
+ '-O0 -g -DDEBUG'
44
+ else
45
+ '-O3'
46
+ end
43
47
 
44
48
  $LDFLAGS += " -Wl,-rpath='\$\$ORIGIN/../ruby-static-tracing' "
45
49
 
46
- create_makefile(MKMF_TARGET, platform_dir("linux"))
50
+ create_makefile(MKMF_TARGET, platform_dir('linux'))
47
51
 
48
52
  # - Darwin/BSD and other dtrace platforms, via libusdt
49
53
  elsif StaticTracing::Platform.darwin?
50
- abort 'dtrace is missing, this platform is not supported' unless have_library("dtrace", "dtrace_open")
54
+ abort 'dtrace is missing, this platform is not supported' unless have_library('dtrace', 'dtrace_open')
51
55
 
52
- LIB_DIRS = [LIB_DIR, RbConfig::CONFIG['libdir']]
56
+ LIB_DIRS = [LIB_DIR, RbConfig::CONFIG['libdir']].freeze
53
57
  puts LIB_DIRS.inspect
54
58
  HEADER_DIRS = [
55
- File.join(BASE_DIR, 'include'),
56
- File.join(BASE_DIR, 'lib', 'libusdt'),
57
- RbConfig::CONFIG['includedir']
58
- ]
59
+ File.join(BASE_DIR, 'include'),
60
+ File.join(BASE_DIR, 'lib', 'libusdt'),
61
+ RbConfig::CONFIG['includedir']
62
+ ].freeze
59
63
 
60
64
  dir_config(MKMF_TARGET, HEADER_DIRS, LIB_DIRS)
61
65
 
62
66
  have_header('usdt.h')
63
- abort "ERROR: libusdt is required. It is included, so this failure is an error." unless have_library('usdt')
67
+ abort 'ERROR: libusdt is required. It is included, so this failure is an error.' unless have_library('usdt')
64
68
 
65
- $CFLAGS = "-D_GNU_SOURCE -Wall " # -Werror complaining
66
- if ENV.key?('DEBUG')
67
- $CFLAGS << "-O0 -g -DDEBUG"
68
- else
69
- $CFLAGS << "-O3"
70
- end
69
+ $CFLAGS = '-D_GNU_SOURCE -Wall ' # -Werror complaining
70
+ $CFLAGS << if ENV.key?('DEBUG')
71
+ '-O0 -g -DDEBUG'
72
+ else
73
+ '-O3'
74
+ end
71
75
 
72
76
  create_makefile(MKMF_TARGET, platform_dir('darwin'))
73
77
  else
74
78
  # - Stub, for other platforms that support neither
75
79
  # for now, we will yolo stub this to leave room to handle platforms
76
80
  # that support properly support conventional dtrace
77
- File.write "Makefile", <<MAKEFILE
78
- all:
79
- clean:
80
- install:
81
- MAKEFILE
81
+ File.write 'Makefile', <<~MAKEFILE
82
+ all:
83
+ clean:
84
+ install:
85
+ MAKEFILE
82
86
  exit
83
87
  end
@@ -7,10 +7,11 @@ Implements Init_ruby_static_tracing, which is used as C/Ruby entrypoint.
7
7
  #define RUBY_STATIC_TRACING_H
8
8
 
9
9
  #include "ruby.h"
10
+
10
11
  #include "provider.h"
11
12
  #include "tracepoint.h"
12
13
 
13
14
  void Init_ruby_static_tracing();
14
15
  extern VALUE eUSDT, eInternal;
15
16
 
16
- #endif //RUBY_STATIC_TRACING_H
17
+ #endif // RUBY_STATIC_TRACING_H
@@ -1,25 +1,27 @@
1
- $LOAD_PATH.unshift File.expand_path("../../../../lib", __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
2
4
 
3
5
  require 'mkmf'
4
6
  require 'ruby-static-tracing/platform'
5
7
 
6
- BASE_DIR = File.expand_path(File.dirname(__FILE__))
7
- LIB_DIR = File.expand_path('../../../../lib/ruby-static-tracing', __FILE__)
8
+ BASE_DIR = __dir__
9
+ LIB_DIR = File.expand_path('../../../lib/ruby-static-tracing', __dir__)
8
10
 
9
- # FIXME have this install libstapsdt
11
+ # FIXME: have this install libstapsdt
10
12
  if StaticTracing::Platform.linux?
11
13
  # This is a bit of a hack to compile libstapsdt.so
12
14
  # and "trick" extconf into thinking it's just another .so
13
- File.write "Makefile", <<MAKEFILE
14
- all:
15
- cd #{File.join(BASE_DIR, 'libstapsdt')} && make CFLAGS_EXTRA=-DLIBSTAPSDT_MEMORY_BACKED_FD
16
- touch deps.so # HACK
17
- cp #{File.join(BASE_DIR, 'libstapsdt', 'out/libstapsdt.so.0')} #{LIB_DIR}
18
- cd #{LIB_DIR} && ln -sf libstapsdt.so.0 libstapsdt.so
19
- clean:
20
- cd #{File.join(BASE_DIR, 'libstapsdt')} && make clean
21
- install:
22
- MAKEFILE
15
+ File.write 'Makefile', <<~MAKEFILE
16
+ all:
17
+ cd #{File.join(BASE_DIR, 'libstapsdt')} && make CFLAGS_EXTRA=-DLIBSTAPSDT_MEMORY_BACKED_FD
18
+ touch deps.so # HACK
19
+ cp #{File.join(BASE_DIR, 'libstapsdt', 'out/libstapsdt.so.0')} #{LIB_DIR}
20
+ cd #{LIB_DIR} && ln -sf libstapsdt.so.0 libstapsdt.so
21
+ clean:
22
+ cd #{File.join(BASE_DIR, 'libstapsdt')} && make clean
23
+ install:
24
+ MAKEFILE
23
25
  exit
24
26
  # We'll build libusdt and install and update linker info
25
27
  elsif StaticTracing::Platform.darwin?
@@ -27,22 +29,22 @@ elsif StaticTracing::Platform.darwin?
27
29
  # and "trick" extconf into thinking it's just another .bundle
28
30
  # After installing it (in post-extconf), we forcefully update the load path for
29
31
  # ruby_static_tracing.bundle to find it in the same directory
30
- File.write "Makefile", <<MAKEFILE
31
- all:
32
- cd #{File.join(BASE_DIR, 'libusdt')} && make libusdt.dylib
33
- touch deps.bundle # HACK
34
- cp #{File.join(BASE_DIR, 'libusdt', 'libusdt.dylib')} #{LIB_DIR}
35
- clean:
36
- cd #{File.join(BASE_DIR, 'libusdt')} && make clean
37
- install:
38
- MAKEFILE
32
+ File.write 'Makefile', <<~MAKEFILE
33
+ all:
34
+ cd #{File.join(BASE_DIR, 'libusdt')} && make libusdt.dylib
35
+ touch deps.bundle # HACK
36
+ cp #{File.join(BASE_DIR, 'libusdt', 'libusdt.dylib')} #{LIB_DIR}
37
+ clean:
38
+ cd #{File.join(BASE_DIR, 'libusdt')} && make clean
39
+ install:
40
+ MAKEFILE
39
41
  exit
40
42
  else
41
43
  # - Stub, for other platforms that we don't support, we write an empty makefile
42
- File.write "Makefile", <<MAKEFILE
43
- all:
44
- clean:
45
- install:
46
- MAKEFILE
44
+ File.write 'Makefile', <<~MAKEFILE
45
+ all:
46
+ clean:
47
+ install:
48
+ MAKEFILE
47
49
  exit
48
50
  end
@@ -1,37 +1,39 @@
1
- $LOAD_PATH.unshift File.expand_path("../../../../lib", __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
2
4
 
3
5
  require 'mkmf'
4
6
  require 'ruby-static-tracing/platform'
5
7
 
6
- BASE_DIR = File.expand_path(File.dirname(__FILE__))
7
- LIB_DIR = File.expand_path('../../../../lib/ruby-static-tracing', __FILE__)
8
+ BASE_DIR = __dir__
9
+ LIB_DIR = File.expand_path('../../../lib/ruby-static-tracing', __dir__)
8
10
 
9
11
  # Linux is a noop
10
12
  if StaticTracing::Platform.linux?
11
- File.write "Makefile", <<MAKEFILE
12
- all:
13
- touch post.so
14
- clean:
15
- install:
16
- MAKEFILE
13
+ File.write 'Makefile', <<~MAKEFILE
14
+ all:
15
+ touch post.so
16
+ clean:
17
+ install:
18
+ MAKEFILE
17
19
  exit
18
20
  # We'll build libusdt and install and update linker info
19
21
  elsif StaticTracing::Platform.darwin?
20
22
  # This is done to ensure that the bundle will look in its local directory for the library
21
- File.write "Makefile", <<MAKEFILE
22
- all:
23
- touch post.bundle
24
- install_name_tool -change libusdt.dylib @loader_path/../ruby-static-tracing/libusdt.dylib #{File.join(LIB_DIR, 'ruby_static_tracing.bundle')}
25
- clean:
26
- install:
27
- MAKEFILE
23
+ File.write 'Makefile', <<~MAKEFILE
24
+ all:
25
+ touch post.bundle
26
+ install_name_tool -change libusdt.dylib @loader_path/../ruby-static-tracing/libusdt.dylib #{File.join(LIB_DIR, 'ruby_static_tracing.bundle')}
27
+ clean:
28
+ install:
29
+ MAKEFILE
28
30
  exit
29
31
  else
30
32
  # - Stub, for other platforms that we don't support, we write an empty makefile
31
- File.write "Makefile", <<MAKEFILE
32
- all:
33
- clean:
34
- install:
35
- MAKEFILE
33
+ File.write 'Makefile', <<~MAKEFILE
34
+ all:
35
+ clean:
36
+ install:
37
+ MAKEFILE
36
38
  exit
37
39
  end
@@ -1,18 +1,17 @@
1
1
  #include "provider.h"
2
2
 
3
- static const rb_data_type_t
4
- static_tracing_provider_type;
3
+ #include <string.h>
4
+
5
+ static const rb_data_type_t static_tracing_provider_type;
5
6
 
6
7
  // Forward decls
7
- static const char*
8
- check_name_arg(VALUE name);
8
+ static const char *check_name_arg(VALUE name);
9
9
 
10
10
  /*
11
11
  Wraps ProviderInit from libstapsdt
12
12
  */
13
13
  VALUE
14
- provider_initialize(VALUE self, VALUE name)
15
- {
14
+ provider_initialize(VALUE self, VALUE name) {
16
15
  const char *c_name_str = NULL;
17
16
  static_tracing_provider_t *res = NULL;
18
17
 
@@ -20,30 +19,51 @@ provider_initialize(VALUE self, VALUE name)
20
19
  c_name_str = check_name_arg(name);
21
20
 
22
21
  // Build provider structure
23
- TypedData_Get_Struct(self, static_tracing_provider_t, &static_tracing_provider_type, res);
22
+ TypedData_Get_Struct(self, static_tracing_provider_t,
23
+ &static_tracing_provider_type, res);
24
24
  res->sdt_provider = providerInit(c_name_str);
25
25
  return self;
26
26
  }
27
27
 
28
28
  // Internal function used to register a tracepoint against a provider instance
29
- SDTProbe_t
30
- *provider_add_tracepoint_internal(VALUE self, const char* name, int argc, Tracepoint_arg_types *args)
31
- {
29
+ SDTProbe_t *provider_add_tracepoint_internal(VALUE self, const char *name,
30
+ int argc,
31
+ Tracepoint_arg_types *args) {
32
32
  static_tracing_provider_t *res = NULL;
33
33
  SDTProbe_t *probe;
34
34
 
35
- TypedData_Get_Struct(self, static_tracing_provider_t, &static_tracing_provider_type, res);
36
-
37
- switch(argc)
38
- {
39
- case 0: probe = providerAddProbe(res->sdt_provider, name, 0); break;
40
- case 1: probe = providerAddProbe(res->sdt_provider, name, argc, args[0]); break;
41
- case 2: probe = providerAddProbe(res->sdt_provider, name, argc, args[0], args[1]); break;
42
- case 3: probe = providerAddProbe(res->sdt_provider, name, argc, args[0], args[1], args[2]); break;
43
- case 4: probe = providerAddProbe(res->sdt_provider, name, argc, args[0], args[1], args[2], args[3]); break;
44
- case 5: probe = providerAddProbe(res->sdt_provider, name, argc, args[0], args[1], args[2], args[3], args[4]); break;
45
- case 6: probe = providerAddProbe(res->sdt_provider, name, argc, args[0], args[1], args[2], args[3], args[4], args[5]); break;
46
- default: probe = providerAddProbe(res->sdt_provider, name, 0); break;
35
+ TypedData_Get_Struct(self, static_tracing_provider_t,
36
+ &static_tracing_provider_type, res);
37
+
38
+ switch (argc) {
39
+ case 0:
40
+ probe = providerAddProbe(res->sdt_provider, name, 0);
41
+ break;
42
+ case 1:
43
+ probe = providerAddProbe(res->sdt_provider, name, argc, args[0]);
44
+ break;
45
+ case 2:
46
+ probe = providerAddProbe(res->sdt_provider, name, argc, args[0], args[1]);
47
+ break;
48
+ case 3:
49
+ probe = providerAddProbe(res->sdt_provider, name, argc, args[0], args[1],
50
+ args[2]);
51
+ break;
52
+ case 4:
53
+ probe = providerAddProbe(res->sdt_provider, name, argc, args[0], args[1],
54
+ args[2], args[3]);
55
+ break;
56
+ case 5:
57
+ probe = providerAddProbe(res->sdt_provider, name, argc, args[0], args[1],
58
+ args[2], args[3], args[4]);
59
+ break;
60
+ case 6:
61
+ probe = providerAddProbe(res->sdt_provider, name, argc, args[0], args[1],
62
+ args[2], args[3], args[4], args[5]);
63
+ break;
64
+ default:
65
+ probe = providerAddProbe(res->sdt_provider, name, 0);
66
+ break;
47
67
  }
48
68
 
49
69
  return probe;
@@ -53,10 +73,10 @@ SDTProbe_t
53
73
  Wraps providerLoad from libstapsdt
54
74
  */
55
75
  VALUE
56
- provider_enable(VALUE self)
57
- {
76
+ provider_enable(VALUE self) {
58
77
  static_tracing_provider_t *res = NULL;
59
- TypedData_Get_Struct(self, static_tracing_provider_t, &static_tracing_provider_type, res);
78
+ TypedData_Get_Struct(self, static_tracing_provider_t,
79
+ &static_tracing_provider_type, res);
60
80
  return providerLoad(res->sdt_provider) == 0 ? Qtrue : Qfalse;
61
81
  }
62
82
 
@@ -64,38 +84,54 @@ provider_enable(VALUE self)
64
84
  Wraps providerUnload from libstapsdt
65
85
  */
66
86
  VALUE
67
- provider_disable(VALUE self)
68
- {
87
+ provider_disable(VALUE self) {
69
88
  static_tracing_provider_t *res = NULL;
70
- TypedData_Get_Struct(self, static_tracing_provider_t, &static_tracing_provider_type, res);
89
+ TypedData_Get_Struct(self, static_tracing_provider_t,
90
+ &static_tracing_provider_type, res);
91
+ res->sdt_provider->_filename = NULL; // FIXME upstream should do this
71
92
  return providerUnload(res->sdt_provider) == 0 ? Qtrue : Qfalse;
72
93
  }
73
94
 
74
95
  /*
75
- Wraps providerUnload from libstapsdt
96
+ Wraps providerDestroy from libstapsdt
76
97
  */
77
98
  VALUE
78
- provider_destroy(VALUE self)
79
- {
99
+ provider_destroy(VALUE self) {
80
100
  static_tracing_provider_t *res = NULL;
81
- TypedData_Get_Struct(self, static_tracing_provider_t, &static_tracing_provider_type, res);
101
+ TypedData_Get_Struct(self, static_tracing_provider_t,
102
+ &static_tracing_provider_type, res);
82
103
  providerDestroy(res->sdt_provider);
83
104
  return Qnil;
84
105
  }
85
106
 
107
+ VALUE
108
+ provider_path(VALUE self) {
109
+ VALUE path;
110
+ char *_path;
111
+ static_tracing_provider_t *res = NULL;
112
+ TypedData_Get_Struct(self, static_tracing_provider_t,
113
+ &static_tracing_provider_type, res);
114
+
115
+ if (res != NULL && res->sdt_provider != NULL &&
116
+ res->sdt_provider->_filename != NULL) {
117
+ _path = res->sdt_provider->_filename;
118
+ path = strlen(_path) > 0 ? rb_str_new_cstr(_path) : rb_str_new_cstr("");
119
+ } else {
120
+ path = rb_str_new_cstr("");
121
+ }
122
+ return path;
123
+ }
124
+
86
125
  // Allocate a static_tracing_provider_type struct for ruby memory management
87
126
  VALUE
88
- static_tracing_provider_alloc(VALUE klass)
89
- {
127
+ static_tracing_provider_alloc(VALUE klass) {
90
128
  static_tracing_provider_t *res;
91
- VALUE obj = TypedData_Make_Struct(klass, static_tracing_provider_t, &static_tracing_provider_type, res);
129
+ VALUE obj = TypedData_Make_Struct(klass, static_tracing_provider_t,
130
+ &static_tracing_provider_type, res);
92
131
  return obj;
93
132
  }
94
133
 
95
-
96
- static const char*
97
- check_name_arg(VALUE name)
98
- {
134
+ static const char *check_name_arg(VALUE name) {
99
135
  const char *c_name_str = NULL;
100
136
 
101
137
  if (TYPE(name) != T_SYMBOL && TYPE(name) != T_STRING) {
@@ -110,36 +146,26 @@ check_name_arg(VALUE name)
110
146
  return c_name_str;
111
147
  }
112
148
 
113
- static inline void
114
- static_tracing_provider_mark(void *ptr)
115
- {
116
- /* noop */
149
+ static inline void static_tracing_provider_mark(void *ptr) { /* noop */
117
150
  }
118
151
 
119
- static inline void
120
- static_tracing_provider_free(void *ptr)
121
- {
122
- static_tracing_provider_t *res = (static_tracing_provider_t *) ptr;
123
- //if (res->name) {
152
+ static inline void static_tracing_provider_free(void *ptr) {
153
+ static_tracing_provider_t *res = (static_tracing_provider_t *)ptr;
154
+ // if (res->name) {
124
155
  // free(res->name);
125
156
  // res->name = NULL;
126
157
  //}
127
158
  xfree(res);
128
159
  }
129
160
 
130
- static inline size_t
131
- static_tracing_provider_memsize(const void *ptr)
132
- {
161
+ static inline size_t static_tracing_provider_memsize(const void *ptr) {
133
162
  return sizeof(static_tracing_provider_t);
134
163
  }
135
164
 
136
- static const rb_data_type_t
137
- static_tracing_provider_type = {
138
- "static_tracing_provider",
139
- {
140
- static_tracing_provider_mark,
141
- static_tracing_provider_free,
142
- static_tracing_provider_memsize
143
- },
144
- NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
145
- };
165
+ static const rb_data_type_t static_tracing_provider_type = {
166
+ "static_tracing_provider",
167
+ {static_tracing_provider_mark, static_tracing_provider_free,
168
+ static_tracing_provider_memsize},
169
+ NULL,
170
+ NULL,
171
+ RUBY_TYPED_FREE_IMMEDIATELY};