ruby-prof 1.3.1 → 1.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES +37 -0
  3. data/README.rdoc +1 -1
  4. data/Rakefile +2 -14
  5. data/ext/ruby_prof/extconf.rb +13 -27
  6. data/ext/ruby_prof/rp_allocation.c +1 -1
  7. data/ext/ruby_prof/rp_call_trees.c +2 -2
  8. data/ext/ruby_prof/rp_measure_allocations.c +1 -1
  9. data/ext/ruby_prof/rp_measure_process_time.c +1 -1
  10. data/ext/ruby_prof/rp_measure_wall_time.c +1 -1
  11. data/ext/ruby_prof/rp_measurement.c +1 -1
  12. data/ext/ruby_prof/rp_method.c +2 -2
  13. data/ext/ruby_prof/rp_method.h +19 -19
  14. data/ext/ruby_prof/rp_profile.c +12 -37
  15. data/ext/ruby_prof/rp_profile.h +0 -1
  16. data/ext/ruby_prof/rp_stack.c +12 -4
  17. data/ext/ruby_prof/rp_thread.c +2 -2
  18. data/ext/ruby_prof/vc/ruby_prof.sln +8 -0
  19. data/ext/ruby_prof/vc/ruby_prof.vcxproj +15 -4
  20. data/lib/ruby-prof.rb +4 -3
  21. data/lib/ruby-prof/compatibility.rb +0 -10
  22. data/lib/ruby-prof/printers/abstract_printer.rb +2 -2
  23. data/lib/ruby-prof/printers/call_stack_printer.rb +1 -0
  24. data/lib/ruby-prof/printers/graph_printer.rb +1 -1
  25. data/lib/ruby-prof/profile.rb +8 -4
  26. data/lib/ruby-prof/rack.rb +51 -130
  27. data/lib/ruby-prof/version.rb +1 -1
  28. data/ruby-prof.gemspec +1 -1
  29. data/test/fiber_test.rb +55 -187
  30. data/test/gc_test.rb +12 -2
  31. data/test/marshal_test.rb +22 -5
  32. data/test/measure_memory_trace_test.rb +361 -2
  33. data/test/printer_call_stack_test.rb +0 -1
  34. data/test/printer_call_tree_test.rb +0 -1
  35. data/test/printer_flat_test.rb +43 -39
  36. data/test/printer_graph_html_test.rb +0 -1
  37. data/test/printer_graph_test.rb +3 -4
  38. data/test/printers_test.rb +3 -3
  39. data/test/printing_recursive_graph_test.rb +1 -1
  40. data/test/profile_test.rb +16 -0
  41. data/test/rack_test.rb +0 -64
  42. data/test/start_stop_test.rb +4 -4
  43. data/test/temp.rb +20 -0
  44. data/test/test_helper.rb +10 -5
  45. metadata +7 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: de991aaaa9b3bae6b7d38da2adac6112e7f254d2927ec3e6cb6e7d1d07fb4c7b
4
- data.tar.gz: 1f246cf6795b6cb955188349c5f4da06e95a3fd94241fbd29aab8dcdcd19d312
3
+ metadata.gz: d823139ee13d55c54104dd034274b61316a525b54ac3802b90dcb111d8ccb3d2
4
+ data.tar.gz: c9ae3a108bbe1f9559848df06a943c4d42e10e4b62a450f8e0278d796ed90f80
5
5
  SHA512:
6
- metadata.gz: bc39dad6f9d5795ba4f48fa674097798de0be279ea9ccae63c2a7c683f22031bbf6bda85b81b46bccd8b4112d30e65b40d5a5dac9311ced4d033f3ccb32fd2de
7
- data.tar.gz: bf04b46a607a9ff896fc6d8eb169447920136ce5a713132993d2f1e830b215c4fa97f9c43253024ddebb289bc5b3f1ceba0200579796f28a9e31c6faffedb698
6
+ metadata.gz: 505e983efedd32bed3cdadff2256e4c9c875551caba829999ec2dd87a36052024612eec9e70ebe586b05b3ee70b95d8c3dba3bd5b14bd01ca1243317a5336313
7
+ data.tar.gz: 9e3430bd9af49f2a045485bc9322f2deabe23bd43575ae00e0718316829d1468492db17476b7a428f6592f7d5fc65ad3f96e68de97a084ff606971ef89d5e14b
data/CHANGES CHANGED
@@ -1,3 +1,40 @@
1
+ 1.4.3 (2021-02-15)
2
+ =====================
3
+ * Remove trailing spaces (sergioro)
4
+ * Enable loading ruby_prof.so from ext directory for development purposes (sergioro)
5
+ * Create temp directory for test output (sergioro)
6
+ * Fix minitest warning about using MT_CPU instead of N (sergioro)
7
+ * Fix minitest warning "Use assert_nil if expecting nil" (sergioro)
8
+ * Fix file permissions (sergioro)
9
+ * Fix failing test by forcing GC to run (Charlie Savage)
10
+ * Switch to GitHub actions (Charlie Savage)
11
+ * Switch to C11 (Charlie Savage)
12
+ * Greatly slim down library size by removing symbols on GCC (Charlie Savage)
13
+
14
+ 1.4.2 (2020-11-3)
15
+ =====================
16
+ * Do NOT use Ruby 2.7.0 and 2.7.1 with ruby-prof. A bug in those versions of ruby causes ruby-prof to
17
+ not work. Version 2.7.2 works correctly.
18
+ * Fix crash caused be reallocating an internal stack that keeps tracks of frames *after* getting a reference to the
19
+ top frame in the stack (Charlie Savage).
20
+ * Fix bug where the flat printer did not correctly report the correct measurement mode.
21
+
22
+ 1.4.1 (2020-05-14)
23
+ =====================
24
+ * Fix compiling on older versions of gcc that do not default to c99 (Charlie Savage)
25
+
26
+ 1.4.0 (2020-05-12)
27
+ =====================
28
+ * API change - remove merge_fibers support since it resulted in incorrect results or crashes (Charlie Savage)
29
+ * Fix crash when profiling memory usage (Charlie Savage)
30
+ * When tracing execution correctly print out newobj tracepoint events (Charlie Savage)
31
+ * Remove no longer needed code for building extensions (Charlie Savage)
32
+
33
+ 1.3.2 (2020-04-19)
34
+ =====================
35
+ * Fix rack profiler so it is thread safe (Charlie Savage)
36
+ * Fix loading of prebuilt binaries on mingw64 to use Ruby's major and minor version (Charlie Savage)
37
+
1
38
  1.3.1 (2020-03-11)
2
39
  =====================
3
40
  * Add max_percent and filter_by options to flat printer (Sean McGivern)
data/README.rdoc CHANGED
@@ -1,5 +1,5 @@
1
1
  = ruby-prof
2
2
 
3
- {<img src="https://travis-ci.org/ruby-prof/ruby-prof.png?branch=master" alt="Build Status" />}[https://travis-ci.org/ruby-prof/ruby-prof]
3
+ ![ruby-prof](https://github.com/ruby-prof/ruby-prof/workflows/ruby-prof/badge.svg)
4
4
 
5
5
  For an overview of ruby-prof please see https://ruby-prof.github.io
data/Rakefile CHANGED
@@ -6,13 +6,6 @@ require "rake/testtask"
6
6
  require "rdoc/task"
7
7
  require "date"
8
8
  require "rake/clean"
9
- begin
10
- require "bundler/setup"
11
- Bundler::GemHelper.install_tasks
12
- [:build, :install, :release].each {|t| Rake::Task[t].enhance [:rdoc] }
13
- rescue LoadError
14
- $stderr.puts "Install bundler to get support for simplified gem publishing"
15
- end
16
9
 
17
10
  # To release a version of ruby-prof:
18
11
  # * Update lib/ruby-prof/version.rb
@@ -23,10 +16,6 @@ end
23
16
  # * rake package to create the gems
24
17
  # * Tag the release (git tag 0.10.1)
25
18
  # * Push to ruybgems.org (gem push pkg/<gem files>)
26
- # For a ruby only release, just run
27
- # * rake release
28
- # it will push changes to github, tag the release, build the package and upload it to rubygems.org
29
- # and in case you forgot to increment the version number or have uncommitted changes, it will refuse to work
30
19
 
31
20
  GEM_NAME = 'ruby-prof'
32
21
  SO_NAME = 'ruby_prof'
@@ -38,9 +27,9 @@ Rake::ExtensionTask.new do |ext|
38
27
  ext.gem_spec = default_spec
39
28
  ext.name = SO_NAME
40
29
  ext.ext_dir = "ext/#{SO_NAME}"
41
- ext.lib_dir = "lib/#{RUBY_VERSION}"
30
+ ext.lib_dir = "lib/#{Gem::Version.new(RUBY_VERSION).segments[0..1].join('.')}"
42
31
  ext.cross_compile = true
43
- ext.cross_platform = ['x86-mingw32', 'x64-mingw32']
32
+ ext.cross_platform = ['x64-mingw32']
44
33
  end
45
34
 
46
35
  # Rake task to build the default package
@@ -58,7 +47,6 @@ if RUBY_PLATFORM.match(/win32|mingw32/)
58
47
  win_spec = default_spec.clone
59
48
  win_spec.platform = Gem::Platform::CURRENT
60
49
  win_spec.files += Dir.glob('lib/**/*.so')
61
- win_spec.instance_variable_set(:@cache_file, nil) # Hack to work around gem issue
62
50
 
63
51
  # Unset extensions
64
52
  win_spec.extensions = nil
@@ -1,36 +1,22 @@
1
1
  require "mkmf"
2
2
 
3
- if RUBY_ENGINE != "ruby"
4
- STDERR.puts("\n\n***** This gem is MRI-specific. It does not support #{RUBY_ENGINE}. *****\n\n")
5
- exit(1)
3
+ # Let's go with a modern version of C! want to intermix declarations and code (ie, don't define
4
+ # all variables at the top of the method). If using Visual Studio, you'll need 2019 version
5
+ # 16.8 or higher
6
+ if RUBY_PLATFORM =~ /mswin/
7
+ $CFLAGS += ' /std:c11'
8
+ else
9
+ $CFLAGS += ' -std=c11'
6
10
  end
7
11
 
8
- if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.4.0')
9
- STDERR.puts("\n\n***** Ruby version #{RUBY_VERSION} is no longer supported. Please upgrade to 2.3 or higher. *****\n\n")
10
- exit(1)
12
+ # For gcc add -s to strip symbols, reducing library size from 17MB to 78KB (at least on Windows with mingw64)
13
+ if RUBY_PLATFORM !~ /mswin/
14
+ $LDFLAGS += ' -s'
11
15
  end
12
16
 
13
- # For the love of bitfields...
14
- $CFLAGS += ' -std=c99'
15
-
16
- # And since we are using C99
17
- CONFIG['warnflags'].gsub!('-Wdeclaration-after-statement', '')
18
-
19
- def add_define(name, value = nil)
20
- if value
21
- $defs.push("-D#{name}=#{value}")
22
- else
23
- $defs.push("-D#{name}")
24
- end
25
- end
26
-
27
- def windows?
28
- RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
17
+ # And since we are using C99 we want to disable Ruby sending these warnings to gcc
18
+ if CONFIG['warnflags']
19
+ CONFIG['warnflags'].gsub!('-Wdeclaration-after-statement', '')
29
20
  end
30
21
 
31
- add_define("RUBY_PROF_RUBY_VERSION", RUBY_VERSION.split('.')[0..2].inject(0){|v,d| v*100+d.to_i})
32
-
33
- # This function was added in Ruby 2.5, so once Ruby 2.4 is no longer supported this can be removed
34
- have_func('rb_tracearg_callee_id', ["ruby.h"])
35
-
36
22
  create_makefile("ruby_prof")
@@ -141,7 +141,7 @@ static const rb_data_type_t allocation_type =
141
141
  },
142
142
  .data = NULL,
143
143
  .flags = RUBY_TYPED_FREE_IMMEDIATELY
144
- };
144
+ };
145
145
 
146
146
  VALUE prof_allocation_wrap(prof_allocation_t* allocation)
147
147
  {
@@ -219,7 +219,7 @@ VALUE prof_call_trees_callers(VALUE self)
219
219
  }
220
220
  }
221
221
 
222
- VALUE result = rb_ary_new_capa(callers->num_entries);
222
+ VALUE result = rb_ary_new_capa((long)callers->num_entries);
223
223
  rb_st_foreach(callers, prof_call_trees_collect_aggregates, result);
224
224
  rb_st_free_table(callers);
225
225
  return result;
@@ -239,7 +239,7 @@ VALUE prof_call_trees_callees(VALUE self)
239
239
  rb_st_foreach((*call_tree)->children, prof_call_trees_collect_callees, (st_data_t)callees);
240
240
  }
241
241
 
242
- VALUE result = rb_ary_new_capa(callees->num_entries);
242
+ VALUE result = rb_ary_new_capa((long)callees->num_entries);
243
243
  rb_st_foreach(callees, prof_call_trees_collect_aggregates, result);
244
244
  rb_st_free_table(callees);
245
245
  return result;
@@ -10,7 +10,7 @@ VALUE total_allocated_objects_key;
10
10
 
11
11
  static double measure_allocations_via_gc_stats(rb_trace_arg_t* trace_arg)
12
12
  {
13
- return rb_gc_stat(total_allocated_objects_key);
13
+ return (double)rb_gc_stat(total_allocated_objects_key);
14
14
  }
15
15
 
16
16
  static double measure_allocations_via_tracing(rb_trace_arg_t* trace_arg)
@@ -24,7 +24,7 @@ static double measure_process_time(rb_trace_arg_t* trace_arg)
24
24
  userTimeInt.LowPart = userTime.dwLowDateTime;
25
25
  userTimeInt.HighPart = userTime.dwHighDateTime;
26
26
 
27
- return sysTimeInt.QuadPart + userTimeInt.QuadPart;
27
+ return (double)(sysTimeInt.QuadPart + userTimeInt.QuadPart);
28
28
  #elif !defined(CLOCK_PROCESS_CPUTIME_ID)
29
29
  struct rusage usage;
30
30
  getrusage(RUSAGE_SELF, &usage);
@@ -17,7 +17,7 @@ static double measure_wall_time(rb_trace_arg_t* trace_arg)
17
17
  #if defined(_WIN32)
18
18
  LARGE_INTEGER time;
19
19
  QueryPerformanceCounter(&time);
20
- return time.QuadPart;
20
+ return (double)time.QuadPart;
21
21
  #elif defined(__APPLE__)
22
22
  return mach_absolute_time();// * (uint64_t)mach_timebase.numer / (uint64_t)mach_timebase.denom;
23
23
  #elif defined(__linux__)
@@ -100,7 +100,7 @@ static const rb_data_type_t measurement_type =
100
100
  },
101
101
  .data = NULL,
102
102
  .flags = RUBY_TYPED_FREE_IMMEDIATELY
103
- };
103
+ };
104
104
 
105
105
  VALUE prof_measurement_wrap(prof_measurement_t* measurement)
106
106
  {
@@ -253,7 +253,7 @@ static const rb_data_type_t method_info_type =
253
253
  },
254
254
  .data = NULL,
255
255
  .flags = RUBY_TYPED_FREE_IMMEDIATELY
256
- };
256
+ };
257
257
 
258
258
  VALUE prof_method_wrap(prof_method_t* method)
259
259
  {
@@ -488,4 +488,4 @@ void rp_init_method_info()
488
488
 
489
489
  rb_define_method(cRpMethodInfo, "_dump_data", prof_method_dump, 0);
490
490
  rb_define_method(cRpMethodInfo, "_load_data", prof_method_load, 1);
491
- }
491
+ }
@@ -9,35 +9,35 @@
9
9
 
10
10
  extern VALUE cRpMethodInfo;
11
11
 
12
- // Source relation bit offsets.
12
+ // Source relation bit offsets.
13
13
  enum {
14
- kModuleIncludee = 0x1, // Included in module
15
- kClassSingleton = 0x2, // Singleton of a class
16
- kModuleSingleton = 0x4, // Singleton of a module
17
- kObjectSingleton = 0x8, // Singleton of an object
18
- kOtherSingleton = 0x10 // Singleton of unkown object
14
+ kModuleIncludee = 0x1, // Included in module
15
+ kClassSingleton = 0x2, // Singleton of a class
16
+ kModuleSingleton = 0x4, // Singleton of a module
17
+ kObjectSingleton = 0x8, // Singleton of an object
18
+ kOtherSingleton = 0x10 // Singleton of unkown object
19
19
  };
20
20
 
21
- // Profiling information for each method.
22
- // Excluded methods have no call_trees, source_klass, or source_file.
21
+ // Profiling information for each method.
22
+ // Excluded methods have no call_trees, source_klass, or source_file.
23
23
  typedef struct prof_method_t
24
24
  {
25
25
  VALUE profile; // Profile this method is associated with - needed for mark phase
26
- struct prof_call_trees_t* call_trees; // Call infos that call this method
27
- st_table* allocations_table; // Tracks object allocations
26
+ struct prof_call_trees_t* call_trees; // Call infos that call this method
27
+ st_table* allocations_table; // Tracks object allocations
28
28
 
29
- st_data_t key; // Table key
30
- unsigned int klass_flags; // Information about the type of class
31
- VALUE klass; // Resolved klass
32
- VALUE klass_name; // Resolved klass name for this method
33
- VALUE method_name; // Resolved method name for this method
29
+ st_data_t key; // Table key
30
+ unsigned int klass_flags; // Information about the type of class
31
+ VALUE klass; // Resolved klass
32
+ VALUE klass_name; // Resolved klass name for this method
33
+ VALUE method_name; // Resolved method name for this method
34
34
 
35
- VALUE object; // Cached ruby object
35
+ VALUE object; // Cached ruby object
36
36
 
37
37
  bool recursive;
38
- int visits; // Current visits on the stack
39
- VALUE source_file; // Source file
40
- int source_line; // Line number
38
+ int visits; // Current visits on the stack
39
+ VALUE source_file; // Source file
40
+ int source_line; // Line number
41
41
 
42
42
  prof_measurement_t* measurement; // Stores measurement data for this method
43
43
  } prof_method_t;
@@ -65,25 +65,19 @@ static const char* get_event_name(rb_event_flag_t event)
65
65
  return "fiber-switch";
66
66
  case RUBY_EVENT_RAISE:
67
67
  return "raise";
68
+ case RUBY_INTERNAL_EVENT_NEWOBJ:
69
+ return "newobj";
68
70
  default:
69
71
  return "unknown";
70
72
  }
71
73
  }
72
74
 
73
- VALUE get_fiber(prof_profile_t* profile)
74
- {
75
- if (profile->merge_fibers)
76
- return rb_thread_current();
77
- else
78
- return rb_fiber_current();
79
- }
80
-
81
75
  thread_data_t* check_fiber(prof_profile_t* profile, double measurement)
82
76
  {
83
77
  thread_data_t* result = NULL;
84
78
 
85
- /* Get the current thread and fiber information. */
86
- VALUE fiber = get_fiber(profile);
79
+ // Get the current fiber
80
+ VALUE fiber = rb_fiber_current();
87
81
 
88
82
  /* We need to switch the profiling context if we either had none before,
89
83
  we don't merge fibers and the fiber ids differ, or the thread ids differ. */
@@ -144,11 +138,7 @@ prof_method_t* check_method(VALUE profile, rb_trace_arg_t* trace_arg, rb_event_f
144
138
  if (klass == cProfile)
145
139
  return NULL;
146
140
 
147
- #ifdef HAVE_RB_TRACEARG_CALLEE_ID
148
141
  VALUE msym = rb_tracearg_callee_id(trace_arg);
149
- #else
150
- VALUE msym = rb_tracearg_method_id(trace_arg);
151
- #endif
152
142
 
153
143
  st_data_t key = method_key(klass, msym);
154
144
 
@@ -164,7 +154,7 @@ prof_method_t* check_method(VALUE profile, rb_trace_arg_t* trace_arg, rb_event_f
164
154
  int source_line = (event != RUBY_EVENT_C_CALL ? FIX2INT(rb_tracearg_lineno(trace_arg)) : 0);
165
155
  result = create_method(profile, key, klass, msym, source_file, source_line);
166
156
  }
167
-
157
+
168
158
  return result;
169
159
  }
170
160
 
@@ -172,7 +162,7 @@ prof_method_t* check_method(VALUE profile, rb_trace_arg_t* trace_arg, rb_event_f
172
162
  static void prof_trace(prof_profile_t* profile, rb_trace_arg_t* trace_arg, double measurement)
173
163
  {
174
164
  static VALUE last_fiber = Qnil;
175
- VALUE fiber = get_fiber(profile);
165
+ VALUE fiber = rb_fiber_current();
176
166
 
177
167
  rb_event_flag_t event = rb_tracearg_event_flag(trace_arg);
178
168
  const char* event_name = get_event_name(event);
@@ -180,11 +170,7 @@ static void prof_trace(prof_profile_t* profile, rb_trace_arg_t* trace_arg, doubl
180
170
  VALUE source_file = rb_tracearg_path(trace_arg);
181
171
  int source_line = FIX2INT(rb_tracearg_lineno(trace_arg));
182
172
 
183
- #ifdef HAVE_RB_TRACEARG_CALLEE_ID
184
173
  VALUE msym = rb_tracearg_callee_id(trace_arg);
185
- #else
186
- VALUE msym = rb_tracearg_method_id(trace_arg);
187
- #endif
188
174
 
189
175
  unsigned int klass_flags;
190
176
  VALUE klass = rb_tracearg_defined_class(trace_arg);
@@ -259,13 +245,13 @@ static void prof_event_hook(VALUE trace_point, void* data)
259
245
  {
260
246
  frame = prof_frame_push(thread_data->stack, call_tree, measurement, RTEST(profile_t->paused));
261
247
  }
262
-
248
+
263
249
  thread_data->call_tree = call_tree;
264
250
  }
265
-
251
+
266
252
  frame->source_file = rb_tracearg_path(trace_arg);
267
253
  frame->source_line = FIX2INT(rb_tracearg_lineno(trace_arg));
268
-
254
+
269
255
  break;
270
256
  }
271
257
  case RUBY_EVENT_CALL:
@@ -288,7 +274,7 @@ static void prof_event_hook(VALUE trace_point, void* data)
288
274
  }
289
275
  else if (!frame && thread_data->call_tree)
290
276
  {
291
- // There is no current parent - likely we have returned out of the highest level method we have profiled so far.
277
+ // There is no current parent - likely we have returned out of the highest level method we have profiled so far.
292
278
  // This can happen with enumerators (see fiber_test.rb). So create a new dummy parent.
293
279
  prof_method_t* parent_method = check_parent_method(profile, thread_data);
294
280
  parent_call_tree = prof_call_tree_create(parent_method, NULL, Qnil, 0);
@@ -427,7 +413,7 @@ static void prof_profile_mark(void* data)
427
413
  rb_st_foreach(profile->exclude_methods_tbl, prof_profile_mark_methods, 0);
428
414
  }
429
415
 
430
- /* Freeing the profile creates a cascade of freeing. It frees its threads table, which frees
416
+ /* Freeing the profile creates a cascade of freeing. It frees its threads table, which frees
431
417
  each thread and its associated call treee and methods. */
432
418
  static void prof_profile_ruby_gc_free(void* data)
433
419
  {
@@ -487,7 +473,6 @@ static VALUE prof_allocate(VALUE klass)
487
473
  profile->include_threads_tbl = NULL;
488
474
  profile->running = Qfalse;
489
475
  profile->allow_exceptions = false;
490
- profile->merge_fibers = false;
491
476
  profile->exclude_methods_tbl = method_table_create();
492
477
  profile->running = Qfalse;
493
478
  profile->tracepoints = rb_ary_new();
@@ -529,9 +514,6 @@ prof_stop_threads(prof_profile_t* profile)
529
514
  If not specified, defaults to RubyProf::WALL_TIME.
530
515
  allow_exceptions: Whether to raise exceptions encountered during profiling,
531
516
  or to suppress all exceptions during profiling
532
- merge_fibers: Whether profiling data for a given thread's fibers should all be
533
- subsumed under a single entry. Basically only useful to produce
534
- callgrind profiles.
535
517
  track_allocations: Whether to track object allocations while profiling. True or false.
536
518
  exclude_common: Exclude common methods from the profile. True or false.
537
519
  exclude_threads: Threads to exclude from the profiling results.
@@ -546,7 +528,6 @@ static VALUE prof_initialize(int argc, VALUE* argv, VALUE self)
546
528
  VALUE include_threads = Qnil;
547
529
  VALUE exclude_common = Qnil;
548
530
  VALUE allow_exceptions = Qfalse;
549
- VALUE merge_fibers = Qfalse;
550
531
  VALUE track_allocations = Qfalse;
551
532
 
552
533
  int i;
@@ -566,7 +547,6 @@ static VALUE prof_initialize(int argc, VALUE* argv, VALUE self)
566
547
  mode = rb_hash_aref(mode_or_options, ID2SYM(rb_intern("measure_mode")));
567
548
  track_allocations = rb_hash_aref(mode_or_options, ID2SYM(rb_intern("track_allocations")));
568
549
  allow_exceptions = rb_hash_aref(mode_or_options, ID2SYM(rb_intern("allow_exceptions")));
569
- merge_fibers = rb_hash_aref(mode_or_options, ID2SYM(rb_intern("merge_fibers")));
570
550
  exclude_common = rb_hash_aref(mode_or_options, ID2SYM(rb_intern("exclude_common")));
571
551
  exclude_threads = rb_hash_aref(mode_or_options, ID2SYM(rb_intern("exclude_threads")));
572
552
  include_threads = rb_hash_aref(mode_or_options, ID2SYM(rb_intern("include_threads")));
@@ -587,7 +567,6 @@ static VALUE prof_initialize(int argc, VALUE* argv, VALUE self)
587
567
  }
588
568
  profile->measurer = prof_get_measurer(NUM2INT(mode), track_allocations == Qtrue);
589
569
  profile->allow_exceptions = (allow_exceptions == Qtrue);
590
- profile->merge_fibers = (merge_fibers == Qtrue);
591
570
 
592
571
  if (exclude_threads != Qnil)
593
572
  {
@@ -679,7 +658,7 @@ static VALUE prof_start(VALUE self)
679
658
 
680
659
  profile->running = Qtrue;
681
660
  profile->paused = Qfalse;
682
- profile->last_thread_data = threads_table_insert(profile, get_fiber(profile));
661
+ profile->last_thread_data = threads_table_insert(profile, rb_fiber_current());
683
662
 
684
663
  /* open trace file if environment wants it */
685
664
  trace_file_name = getenv("RUBY_PROF_TRACE");
@@ -769,11 +748,7 @@ static VALUE prof_stop(VALUE self)
769
748
  {
770
749
  if (trace_file != stderr && trace_file != stdout)
771
750
  {
772
- #ifdef _MSC_VER
773
- _fcloseall();
774
- #else
775
751
  fclose(trace_file);
776
- #endif
777
752
  }
778
753
  trace_file = NULL;
779
754
  }