mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-19 21:39:57 +00:00
profiler fix
This commit is contained in:
parent
3e892924bd
commit
7806a6e714
1 changed files with 2 additions and 4 deletions
|
|
@ -8,7 +8,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
VALUE tp = Qnil;
|
VALUE tp = Qnil;
|
||||||
static std::vector<uint64_t> call_stack; // Глобальный стек вместо thread-local
|
static std::vector<uint64_t> call_stack;
|
||||||
|
|
||||||
static uint64_t now_ns(void) {
|
static uint64_t now_ns(void) {
|
||||||
timespec ts;
|
timespec ts;
|
||||||
|
|
@ -35,12 +35,11 @@ static void tp_cb(VALUE tpval, void *) {
|
||||||
call_stack.pop_back();
|
call_stack.pop_back();
|
||||||
uint64_t dur_ns = end_ns - start_ns;
|
uint64_t dur_ns = end_ns - start_ns;
|
||||||
|
|
||||||
// Сохраняем VALUE в переменные ПЕРЕД StringValuePtr
|
|
||||||
VALUE path_val = rb_tracearg_path(trace_arg);
|
VALUE path_val = rb_tracearg_path(trace_arg);
|
||||||
VALUE class_val = rb_tracearg_defined_class(trace_arg);
|
VALUE class_val = rb_tracearg_defined_class(trace_arg);
|
||||||
|
|
||||||
const char *path = StringValuePtr(path_val);
|
const char *path = StringValuePtr(path_val);
|
||||||
const char *class_name = StringValuePtr(class_val);
|
const char *class_name = rb_class2name(class_val);
|
||||||
long line = FIX2LONG(rb_tracearg_lineno(trace_arg));
|
long line = FIX2LONG(rb_tracearg_lineno(trace_arg));
|
||||||
const char *method = rb_id2name((ID)rb_tracearg_method_id(trace_arg));
|
const char *method = rb_id2name((ID)rb_tracearg_method_id(trace_arg));
|
||||||
|
|
||||||
|
|
@ -49,7 +48,6 @@ static void tp_cb(VALUE tpval, void *) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static VALUE profiler_set(VALUE, VALUE v) {
|
static VALUE profiler_set(VALUE, VALUE v) {
|
||||||
if (NIL_P(tp)) {
|
if (NIL_P(tp)) {
|
||||||
rb_raise(rb_eRuntimeError, "Profiler not initialized");
|
rb_raise(rb_eRuntimeError, "Profiler not initialized");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue