ruby-prof 1.3.0-x64-mingw32 → 1.4.3-x64-mingw32
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 +4 -4
- data/CHANGES +42 -0
- data/README.rdoc +1 -1
- data/Rakefile +2 -14
- data/ext/ruby_prof/extconf.rb +13 -27
- data/ext/ruby_prof/rp_allocation.c +1 -1
- data/ext/ruby_prof/rp_call_trees.c +2 -2
- data/ext/ruby_prof/rp_measure_allocations.c +1 -1
- data/ext/ruby_prof/rp_measure_process_time.c +1 -1
- data/ext/ruby_prof/rp_measure_wall_time.c +1 -1
- data/ext/ruby_prof/rp_measurement.c +1 -1
- data/ext/ruby_prof/rp_method.c +2 -2
- data/ext/ruby_prof/rp_method.h +19 -19
- data/ext/ruby_prof/rp_profile.c +12 -37
- data/ext/ruby_prof/rp_profile.h +0 -1
- data/ext/ruby_prof/rp_stack.c +12 -4
- data/ext/ruby_prof/rp_thread.c +2 -2
- data/ext/ruby_prof/vc/ruby_prof.sln +8 -0
- data/ext/ruby_prof/vc/ruby_prof.vcxproj +15 -4
- data/lib/2.7/ruby_prof.so +0 -0
- data/lib/3.0/ruby_prof.so +0 -0
- data/lib/ruby-prof.rb +4 -3
- data/lib/ruby-prof/compatibility.rb +0 -10
- data/lib/ruby-prof/printers/abstract_printer.rb +13 -3
- data/lib/ruby-prof/printers/call_stack_printer.rb +1 -0
- data/lib/ruby-prof/printers/flat_printer.rb +3 -2
- data/lib/ruby-prof/printers/graph_printer.rb +1 -1
- data/lib/ruby-prof/profile.rb +8 -4
- data/lib/ruby-prof/rack.rb +51 -130
- data/lib/ruby-prof/version.rb +1 -1
- data/ruby-prof.gemspec +1 -1
- data/test/fiber_test.rb +55 -187
- data/test/gc_test.rb +12 -2
- data/test/marshal_test.rb +22 -5
- data/test/measure_memory_trace_test.rb +361 -2
- data/test/printer_call_stack_test.rb +0 -1
- data/test/printer_call_tree_test.rb +0 -1
- data/test/printer_flat_test.rb +61 -30
- data/test/printer_graph_html_test.rb +0 -1
- data/test/printer_graph_test.rb +3 -4
- data/test/printers_test.rb +3 -3
- data/test/printing_recursive_graph_test.rb +1 -1
- data/test/profile_test.rb +16 -0
- data/test/rack_test.rb +0 -64
- data/test/start_stop_test.rb +4 -4
- data/test/temp.rb +20 -0
- data/test/test_helper.rb +10 -5
- metadata +9 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff6376af9ff0bca0c82428adbe82fac0b61baaa885ec1c0838f00615b473c5a5
|
4
|
+
data.tar.gz: 5501219e23555b6b4d695e3539ea65ef1491f5387ed19be63e8ccda546196304
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f177dccca89487aad943de3b049b40929c2576fcda0fc05e6c41cbcbef99b78e9c42717297341edf15bafd78da8596b2d5a44522a899ddf7437645f621aae9c2
|
7
|
+
data.tar.gz: 0450be219e2a2caa86c75ecccb8384ecfcb4293aff82e4a6b3a7165b8a09bad25cc9e4629d0d0340887a455e854d0e42d432b4f96ba13c359adcf4ad424e54a8
|
data/CHANGES
CHANGED
@@ -1,3 +1,45 @@
|
|
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
|
+
|
38
|
+
1.3.1 (2020-03-11)
|
39
|
+
=====================
|
40
|
+
* Add max_percent and filter_by options to flat printer (Sean McGivern)
|
41
|
+
* Include binary in mingw64 build (Charlie Savage)
|
42
|
+
|
1
43
|
1.3.0 (2020-02-22)
|
2
44
|
=====================
|
3
45
|
* Update C code to use newer RTypedData API versus older RData API.
|
data/README.rdoc
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
= ruby-prof
|
2
2
|
|
3
|
-
|
3
|
+

|
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 = ['
|
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
|
data/ext/ruby_prof/extconf.rb
CHANGED
@@ -1,36 +1,22 @@
|
|
1
1
|
require "mkmf"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
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
|
-
|
9
|
-
|
10
|
-
|
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
|
-
#
|
14
|
-
|
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")
|
@@ -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__)
|
data/ext/ruby_prof/rp_method.c
CHANGED
@@ -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
|
+
}
|
data/ext/ruby_prof/rp_method.h
CHANGED
@@ -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;
|
data/ext/ruby_prof/rp_profile.c
CHANGED
@@ -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
|
-
|
86
|
-
VALUE fiber =
|
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 =
|
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,
|
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
|
}
|