tmm1-perftools.rb 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/perftools.c +8 -0
- data/perftools.rb.gemspec +1 -1
- metadata +1 -1
data/ext/perftools.c
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
#include <env.h>
|
4
4
|
|
5
5
|
static VALUE Iallocate;
|
6
|
+
static VALUE I__send__;
|
6
7
|
|
7
8
|
static inline void
|
8
9
|
save_frame(struct FRAME *frame, void** result, int *depth)
|
@@ -12,6 +13,9 @@ save_frame(struct FRAME *frame, void** result, int *depth)
|
|
12
13
|
// if (BUILTIN_TYPE(klass) == T_ICLASS)
|
13
14
|
// klass = RBASIC(klass)->klass;
|
14
15
|
|
16
|
+
if (frame->last_func == I__send__)
|
17
|
+
return;
|
18
|
+
|
15
19
|
if (FL_TEST(klass, FL_SINGLETON) &&
|
16
20
|
(BUILTIN_TYPE(frame->self) == T_CLASS || BUILTIN_TYPE(frame->self) == T_MODULE))
|
17
21
|
result[(*depth)++] = (void*) frame->self;
|
@@ -42,6 +46,8 @@ rb_stack_trace(void** result, int max_depth)
|
|
42
46
|
}
|
43
47
|
#endif
|
44
48
|
|
49
|
+
// XXX SIGPROF can come in while ruby_frame is in an inconsistent state (rb_call0), so we ignore the top-most frame
|
50
|
+
/*
|
45
51
|
// XXX does it make sense to track allocations or not?
|
46
52
|
if (frame->last_func == ID_ALLOCATOR) {
|
47
53
|
frame = frame->prev;
|
@@ -50,6 +56,7 @@ rb_stack_trace(void** result, int max_depth)
|
|
50
56
|
if (frame->last_func) {
|
51
57
|
save_frame(frame, result, &depth);
|
52
58
|
}
|
59
|
+
*/
|
53
60
|
|
54
61
|
for (; frame && (n = frame->node); frame = frame->prev) {
|
55
62
|
if (frame->prev && frame->prev->last_func) {
|
@@ -122,6 +129,7 @@ Init_perftools()
|
|
122
129
|
cCpuProfiler = rb_define_class_under(cPerfTools, "CpuProfiler", rb_cObject);
|
123
130
|
bProfilerRunning = Qfalse;
|
124
131
|
Iallocate = rb_intern("allocate");
|
132
|
+
I__send__ = rb_intern("__send__");
|
125
133
|
|
126
134
|
rb_define_singleton_method(cCpuProfiler, "running?", cpuprofiler_running_p, 0);
|
127
135
|
rb_define_singleton_method(cCpuProfiler, "start", cpuprofiler_start, 1);
|
data/perftools.rb.gemspec
CHANGED