pf2 0.6.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/Cargo.lock +6 -26
- data/crates/backtrace-sys2/build.rs +1 -4
- data/crates/backtrace-sys2/src/libbacktrace/Makefile.am +116 -31
- data/crates/backtrace-sys2/src/libbacktrace/Makefile.in +295 -141
- data/crates/backtrace-sys2/src/libbacktrace/README.md +11 -1
- data/crates/backtrace-sys2/src/libbacktrace/alloc.c +1 -1
- data/crates/backtrace-sys2/src/libbacktrace/allocfail.c +1 -1
- data/crates/backtrace-sys2/src/libbacktrace/allocfail.sh +1 -1
- data/crates/backtrace-sys2/src/libbacktrace/atomic.c +1 -1
- data/crates/backtrace-sys2/src/libbacktrace/backtrace-supported.h.in +1 -1
- data/crates/backtrace-sys2/src/libbacktrace/backtrace.c +1 -1
- data/crates/backtrace-sys2/src/libbacktrace/backtrace.h +12 -12
- data/crates/backtrace-sys2/src/libbacktrace/btest.c +24 -8
- data/crates/backtrace-sys2/src/libbacktrace/config/libtool.m4 +162 -53
- data/crates/backtrace-sys2/src/libbacktrace/config.h.in +3 -0
- data/crates/backtrace-sys2/src/libbacktrace/configure +255 -66
- data/crates/backtrace-sys2/src/libbacktrace/configure.ac +27 -8
- data/crates/backtrace-sys2/src/libbacktrace/dwarf.c +37 -30
- data/crates/backtrace-sys2/src/libbacktrace/edtest.c +2 -2
- data/crates/backtrace-sys2/src/libbacktrace/edtest2.c +1 -1
- data/crates/backtrace-sys2/src/libbacktrace/elf.c +98 -76
- data/crates/backtrace-sys2/src/libbacktrace/fileline.c +1 -1
- data/crates/backtrace-sys2/src/libbacktrace/install-debuginfo-for-buildid.sh.in +2 -2
- data/crates/backtrace-sys2/src/libbacktrace/instrumented_alloc.c +1 -1
- data/crates/backtrace-sys2/src/libbacktrace/internal.h +41 -2
- data/crates/backtrace-sys2/src/libbacktrace/macho.c +25 -19
- data/crates/backtrace-sys2/src/libbacktrace/mmap.c +1 -1
- data/crates/backtrace-sys2/src/libbacktrace/mmapio.c +1 -1
- data/crates/backtrace-sys2/src/libbacktrace/mtest.c +4 -4
- data/crates/backtrace-sys2/src/libbacktrace/nounwind.c +1 -1
- data/crates/backtrace-sys2/src/libbacktrace/pecoff.c +192 -26
- data/crates/backtrace-sys2/src/libbacktrace/posix.c +1 -1
- data/crates/backtrace-sys2/src/libbacktrace/print.c +41 -16
- data/crates/backtrace-sys2/src/libbacktrace/read.c +1 -1
- data/crates/backtrace-sys2/src/libbacktrace/simple.c +1 -1
- data/crates/backtrace-sys2/src/libbacktrace/sort.c +1 -1
- data/crates/backtrace-sys2/src/libbacktrace/state.c +1 -1
- data/crates/backtrace-sys2/src/libbacktrace/stest.c +1 -1
- data/crates/backtrace-sys2/src/libbacktrace/test_format.c +1 -1
- data/crates/backtrace-sys2/src/libbacktrace/testlib.c +1 -1
- data/crates/backtrace-sys2/src/libbacktrace/testlib.h +1 -1
- data/crates/backtrace-sys2/src/libbacktrace/ttest.c +1 -1
- data/crates/backtrace-sys2/src/libbacktrace/unittest.c +1 -1
- data/crates/backtrace-sys2/src/libbacktrace/unknown.c +1 -1
- data/crates/backtrace-sys2/src/libbacktrace/xcoff.c +43 -32
- data/crates/backtrace-sys2/src/libbacktrace/xztest.c +2 -2
- data/crates/backtrace-sys2/src/libbacktrace/zstdtest.c +1 -1
- data/crates/backtrace-sys2/src/libbacktrace/ztest.c +1 -1
- data/ext/pf2/Cargo.toml +1 -1
- data/ext/pf2/src/profile_serializer.rs +5 -12
- data/ext/pf2/src/ringbuffer.rs +1 -3
- data/ext/pf2/src/ruby_init.rs +1 -4
- data/ext/pf2/src/sample.rs +1 -0
- data/ext/pf2/src/serialization/profile.rs +2 -1
- data/ext/pf2/src/serialization/serializer.rs +227 -48
- data/ext/pf2/src/session/new_thread_watcher.rs +1 -1
- data/ext/pf2/src/session/ruby_object.rs +1 -5
- data/ext/pf2/src/session.rs +5 -15
- data/ext/pf2/src/signal_scheduler.rs +9 -10
- data/ext/pf2/src/timer_thread_scheduler.rs +8 -6
- data/lib/pf2/cli.rb +2 -0
- data/lib/pf2/reporter/firefox_profiler.rb +2 -0
- data/lib/pf2/reporter/stack_weaver.rb +81 -0
- data/lib/pf2/reporter.rb +3 -4
- data/lib/pf2/serve.rb +2 -0
- data/lib/pf2/session.rb +2 -0
- data/lib/pf2/version.rb +3 -1
- data/lib/pf2.rb +4 -1
- data/rust-toolchain.toml +2 -0
- data/rustfmt.toml +1 -0
- metadata +10 -12
- data/crates/backtrace-sys2/src/libbacktrace/libtool.m4 +0 -7436
- data/crates/backtrace-sys2/src/libbacktrace/ltoptions.m4 +0 -369
- data/crates/backtrace-sys2/src/libbacktrace/ltsugar.m4 +0 -123
- data/crates/backtrace-sys2/src/libbacktrace/ltversion.m4 +0 -23
- data/crates/backtrace-sys2/src/libbacktrace/lt~obsolete.m4 +0 -98
@@ -1,5 +1,5 @@
|
|
1
1
|
/* stest.c -- Test for libbacktrace internal sort function
|
2
|
-
Copyright (C) 2012-
|
2
|
+
Copyright (C) 2012-2024 Free Software Foundation, Inc.
|
3
3
|
Written by Ian Lance Taylor, Google.
|
4
4
|
|
5
5
|
Redistribution and use in source and binary forms, with or without
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/* test_format.c -- Test for libbacktrace library
|
2
|
-
Copyright (C) 2018-
|
2
|
+
Copyright (C) 2018-2024 Free Software Foundation, Inc.
|
3
3
|
|
4
4
|
Redistribution and use in source and binary forms, with or without
|
5
5
|
modification, are permitted provided that the following conditions are
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/* testlib.c -- test functions for libbacktrace library
|
2
|
-
Copyright (C) 2012-
|
2
|
+
Copyright (C) 2012-2024 Free Software Foundation, Inc.
|
3
3
|
Written by Ian Lance Taylor, Google.
|
4
4
|
|
5
5
|
Redistribution and use in source and binary forms, with or without
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/* testlib.h -- Header for test functions for libbacktrace library
|
2
|
-
Copyright (C) 2012-
|
2
|
+
Copyright (C) 2012-2024 Free Software Foundation, Inc.
|
3
3
|
Written by Ian Lance Taylor, Google.
|
4
4
|
|
5
5
|
Redistribution and use in source and binary forms, with or without
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/* unittest.c -- Test for libbacktrace library
|
2
|
-
Copyright (C) 2018-
|
2
|
+
Copyright (C) 2018-2024 Free Software Foundation, Inc.
|
3
3
|
|
4
4
|
Redistribution and use in source and binary forms, with or without
|
5
5
|
modification, are permitted provided that the following conditions are
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/* unknown.c -- used when backtrace configury does not know file format.
|
2
|
-
Copyright (C) 2012-
|
2
|
+
Copyright (C) 2012-2024 Free Software Foundation, Inc.
|
3
3
|
Written by Ian Lance Taylor, Google.
|
4
4
|
|
5
5
|
Redistribution and use in source and binary forms, with or without
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/* xcoff.c -- Get debug data from an XCOFF file for backtraces.
|
2
|
-
Copyright (C) 2012-
|
2
|
+
Copyright (C) 2012-2024 Free Software Foundation, Inc.
|
3
3
|
Adapted from elf.c.
|
4
4
|
|
5
5
|
Redistribution and use in source and binary forms, with or without
|
@@ -133,6 +133,7 @@ typedef struct {
|
|
133
133
|
#define SSUBTYP_DWARNGE 0x50000 /* DWARF aranges section. */
|
134
134
|
#define SSUBTYP_DWABREV 0x60000 /* DWARF abbreviation section. */
|
135
135
|
#define SSUBTYP_DWSTR 0x70000 /* DWARF strings section. */
|
136
|
+
#define SSUBTYP_DWRNGES 0x80000 /* DWARF ranges section. */
|
136
137
|
|
137
138
|
/* XCOFF symbol. */
|
138
139
|
|
@@ -384,7 +385,7 @@ struct xcoff_fileline_data
|
|
384
385
|
size_t linenos_size;
|
385
386
|
uint64_t lnnoptr0;
|
386
387
|
/* Loader address. */
|
387
|
-
|
388
|
+
struct libbacktrace_base_address base_address;
|
388
389
|
};
|
389
390
|
|
390
391
|
/* Information we gather for the DWARF sections we care about. */
|
@@ -585,8 +586,7 @@ xcoff_symname (const b_xcoff_syment *asym,
|
|
585
586
|
|
586
587
|
static int
|
587
588
|
xcoff_initialize_syminfo (struct backtrace_state *state,
|
588
|
-
|
589
|
-
const b_xcoff_scnhdr *sects,
|
589
|
+
struct libbacktrace_base_address base_address,
|
590
590
|
const b_xcoff_syment *syms, size_t nsyms,
|
591
591
|
const unsigned char *strtab, size_t strtab_size,
|
592
592
|
backtrace_error_callback error_callback, void *data,
|
@@ -628,8 +628,8 @@ xcoff_initialize_syminfo (struct backtrace_state *state,
|
|
628
628
|
{
|
629
629
|
const b_xcoff_auxent *aux = (const b_xcoff_auxent *) (asym + 1);
|
630
630
|
xcoff_symbols[j].name = xcoff_symname (asym, strtab, strtab_size);
|
631
|
-
xcoff_symbols[j].address =
|
632
|
-
|
631
|
+
xcoff_symbols[j].address =
|
632
|
+
libbacktrace_add_base (asym->n_value, base_address);
|
633
633
|
/* x_fsize will be 0 if there is no debug information. */
|
634
634
|
xcoff_symbols[j].size = aux->x_fcn.x_fsize;
|
635
635
|
++j;
|
@@ -767,7 +767,8 @@ xcoff_lookup_pc (struct backtrace_state *state ATTRIBUTE_UNUSED,
|
|
767
767
|
lineno = (const b_xcoff_lineno *) lineptr;
|
768
768
|
if (lineno->l_lnno == 0)
|
769
769
|
break;
|
770
|
-
if (pc <=
|
770
|
+
if (pc <= libbacktrace_add_base (lineno->l_addr.l_paddr,
|
771
|
+
fdata->base_address))
|
771
772
|
break;
|
772
773
|
match = lnnoptr;
|
773
774
|
lnno = lineno->l_lnno;
|
@@ -861,7 +862,7 @@ xcoff_fileline (struct backtrace_state *state, uintptr_t pc,
|
|
861
862
|
|
862
863
|
static int
|
863
864
|
xcoff_initialize_fileline (struct backtrace_state *state,
|
864
|
-
|
865
|
+
struct libbacktrace_base_address base_address,
|
865
866
|
const b_xcoff_scnhdr *sects,
|
866
867
|
const b_xcoff_syment *syms, size_t nsyms,
|
867
868
|
const unsigned char *strtab, size_t strtab_size,
|
@@ -1002,7 +1003,7 @@ xcoff_initialize_fileline (struct backtrace_state *state,
|
|
1002
1003
|
fn->name = xcoff_symname (fsym, strtab, strtab_size);
|
1003
1004
|
fn->filename = filename;
|
1004
1005
|
fn->sect_base = sects[fsym->n_scnum - 1].s_paddr;
|
1005
|
-
fn->pc =
|
1006
|
+
fn->pc = libbacktrace_add_base (fsym->n_value, base_address);
|
1006
1007
|
fn->size = fsize;
|
1007
1008
|
fn->lnno = lnno;
|
1008
1009
|
fn->lnnoptr = lnnoptr;
|
@@ -1071,7 +1072,8 @@ fail:
|
|
1071
1072
|
|
1072
1073
|
static int
|
1073
1074
|
xcoff_add (struct backtrace_state *state, int descriptor, off_t offset,
|
1074
|
-
|
1075
|
+
struct libbacktrace_base_address base_address,
|
1076
|
+
backtrace_error_callback error_callback,
|
1075
1077
|
void *data, fileline *fileline_fn, int *found_sym, int exe)
|
1076
1078
|
{
|
1077
1079
|
struct backtrace_view fhdr_view;
|
@@ -1153,8 +1155,16 @@ xcoff_add (struct backtrace_state *state, int descriptor, off_t offset,
|
|
1153
1155
|
|
1154
1156
|
stext = §s[i];
|
1155
1157
|
|
1156
|
-
/*
|
1157
|
-
|
1158
|
+
/* base_address represents the difference between the
|
1159
|
+
virtual memory address of the shared object or a loaded
|
1160
|
+
executable and the offset of that object in the file
|
1161
|
+
from which it was loaded.
|
1162
|
+
On AIX, virtual address is either fixed for executable
|
1163
|
+
or given by ldinfo. This address will include the XCOFF
|
1164
|
+
headers. */
|
1165
|
+
base_address.m = ((exe ? XCOFF_AIX_TEXTBASE : base_address.m)
|
1166
|
+
+ stext->s_scnptr
|
1167
|
+
- stext->s_paddr);
|
1158
1168
|
|
1159
1169
|
lnnoptr = stext->s_lnnoptr;
|
1160
1170
|
nlnno = stext->s_nlnno;
|
@@ -1193,7 +1203,9 @@ xcoff_add (struct backtrace_state *state, int descriptor, off_t offset,
|
|
1193
1203
|
goto fail;
|
1194
1204
|
syms_view_valid = 1;
|
1195
1205
|
|
1196
|
-
memcpy (&str_size,
|
1206
|
+
memcpy (&str_size,
|
1207
|
+
(const unsigned char *) syms_view.data + syms_size,
|
1208
|
+
4);
|
1197
1209
|
|
1198
1210
|
str_off = fhdr.f_symptr + syms_size;
|
1199
1211
|
|
@@ -1212,7 +1224,7 @@ xcoff_add (struct backtrace_state *state, int descriptor, off_t offset,
|
|
1212
1224
|
if (sdata == NULL)
|
1213
1225
|
goto fail;
|
1214
1226
|
|
1215
|
-
if (!xcoff_initialize_syminfo (state, base_address,
|
1227
|
+
if (!xcoff_initialize_syminfo (state, base_address,
|
1216
1228
|
syms_view.data, fhdr.f_nsyms,
|
1217
1229
|
str_view.data, str_size,
|
1218
1230
|
error_callback, data, sdata))
|
@@ -1252,7 +1264,7 @@ xcoff_add (struct backtrace_state *state, int descriptor, off_t offset,
|
|
1252
1264
|
case SSUBTYP_DWABREV:
|
1253
1265
|
idx = DEBUG_ABBREV;
|
1254
1266
|
break;
|
1255
|
-
case
|
1267
|
+
case SSUBTYP_DWRNGES:
|
1256
1268
|
idx = DEBUG_RANGES;
|
1257
1269
|
break;
|
1258
1270
|
case SSUBTYP_DWSTR:
|
@@ -1290,13 +1302,7 @@ xcoff_add (struct backtrace_state *state, int descriptor, off_t offset,
|
|
1290
1302
|
|
1291
1303
|
dwarf_sections.data[DEBUG_INFO] = dwsect[DEBUG_INFO].data;
|
1292
1304
|
dwarf_sections.size[DEBUG_INFO] = dwsect[DEBUG_INFO].size;
|
1293
|
-
|
1294
|
-
/* XXX workaround for broken lineoff */
|
1295
|
-
dwarf_sections.data[DEBUG_LINE] = dwsect[DEBUG_LINE].data - 4;
|
1296
|
-
#else
|
1297
|
-
/* XXX workaround for broken lineoff */
|
1298
|
-
dwarf_sections.data[DEBUG_LINE] = dwsect[DEBUG_LINE].data - 12;
|
1299
|
-
#endif
|
1305
|
+
dwarf_sections.data[DEBUG_LINE] = dwsect[DEBUG_LINE].data;
|
1300
1306
|
dwarf_sections.size[DEBUG_LINE] = dwsect[DEBUG_LINE].size;
|
1301
1307
|
dwarf_sections.data[DEBUG_ABBREV] = dwsect[DEBUG_ABBREV].data;
|
1302
1308
|
dwarf_sections.size[DEBUG_ABBREV] = dwsect[DEBUG_ABBREV].size;
|
@@ -1305,7 +1311,7 @@ xcoff_add (struct backtrace_state *state, int descriptor, off_t offset,
|
|
1305
1311
|
dwarf_sections.data[DEBUG_STR] = dwsect[DEBUG_STR].data;
|
1306
1312
|
dwarf_sections.size[DEBUG_STR] = dwsect[DEBUG_STR].size;
|
1307
1313
|
|
1308
|
-
if (!backtrace_dwarf_add (state,
|
1314
|
+
if (!backtrace_dwarf_add (state, base_address, &dwarf_sections,
|
1309
1315
|
1, /* big endian */
|
1310
1316
|
NULL, /* altlink */
|
1311
1317
|
error_callback, data, fileline_fn,
|
@@ -1390,9 +1396,9 @@ xcoff_parse_decimal (const char *buf, size_t size, off_t *off)
|
|
1390
1396
|
|
1391
1397
|
static int
|
1392
1398
|
xcoff_armem_add (struct backtrace_state *state, int descriptor,
|
1393
|
-
|
1394
|
-
|
1395
|
-
fileline *fileline_fn, int *found_sym)
|
1399
|
+
struct libbacktrace_base_address base_address,
|
1400
|
+
const char *member, backtrace_error_callback error_callback,
|
1401
|
+
void *data, fileline *fileline_fn, int *found_sym)
|
1396
1402
|
{
|
1397
1403
|
struct backtrace_view view;
|
1398
1404
|
b_ar_fl_hdr fl_hdr;
|
@@ -1513,6 +1519,8 @@ xcoff_add_shared_libs (struct backtrace_state *state,
|
|
1513
1519
|
ldinfo = (const struct ld_info *) buf;
|
1514
1520
|
while ((const char *) ldinfo < (const char *) buf + buflen)
|
1515
1521
|
{
|
1522
|
+
struct libbacktrace_base_address base_address;
|
1523
|
+
|
1516
1524
|
if (*ldinfo->ldinfo_filename != '/')
|
1517
1525
|
goto next;
|
1518
1526
|
|
@@ -1524,16 +1532,17 @@ xcoff_add_shared_libs (struct backtrace_state *state,
|
|
1524
1532
|
/* Check if it is an archive (member name not empty). */
|
1525
1533
|
|
1526
1534
|
member = ldinfo->ldinfo_filename + strlen (ldinfo->ldinfo_filename) + 1;
|
1535
|
+
memset (&base_address, 0, sizeof base_address);
|
1536
|
+
base_address.m = (uintptr_t) ldinfo->ldinfo_textorg;
|
1527
1537
|
if (*member)
|
1528
1538
|
{
|
1529
|
-
xcoff_armem_add (state, descriptor,
|
1530
|
-
(uintptr_t) ldinfo->ldinfo_textorg, member,
|
1539
|
+
xcoff_armem_add (state, descriptor, base_address, member,
|
1531
1540
|
error_callback, data, fileline_fn, &lib_found_sym);
|
1532
1541
|
}
|
1533
1542
|
else
|
1534
1543
|
{
|
1535
|
-
xcoff_add (state, descriptor, 0,
|
1536
|
-
|
1544
|
+
xcoff_add (state, descriptor, 0, base_address, error_callback, data,
|
1545
|
+
fileline_fn, &lib_found_sym, 0);
|
1537
1546
|
}
|
1538
1547
|
if (lib_found_sym)
|
1539
1548
|
*found_sym = 1;
|
@@ -1558,12 +1567,14 @@ backtrace_initialize (struct backtrace_state *state,
|
|
1558
1567
|
backtrace_error_callback error_callback,
|
1559
1568
|
void *data, fileline *fileline_fn)
|
1560
1569
|
{
|
1570
|
+
struct libbacktrace_base_address zero_base_address;
|
1561
1571
|
int ret;
|
1562
1572
|
int found_sym;
|
1563
1573
|
fileline xcoff_fileline_fn = xcoff_nodebug;
|
1564
1574
|
|
1565
|
-
|
1566
|
-
|
1575
|
+
memset (&zero_base_address, 0, sizeof zero_base_address);
|
1576
|
+
ret = xcoff_add (state, descriptor, 0, zero_base_address,
|
1577
|
+
error_callback, data, &xcoff_fileline_fn, &found_sym, 1);
|
1567
1578
|
if (!ret)
|
1568
1579
|
return 0;
|
1569
1580
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/* xztest.c -- Test for libbacktrace LZMA decoder.
|
2
|
-
Copyright (C) 2020-
|
2
|
+
Copyright (C) 2020-2024 Free Software Foundation, Inc.
|
3
3
|
Written by Ian Lance Taylor, Google.
|
4
4
|
|
5
5
|
Redistribution and use in source and binary forms, with or without
|
@@ -172,7 +172,7 @@ test_samples (struct backtrace_state *state)
|
|
172
172
|
tests[i].name, uncompressed_len, v);
|
173
173
|
++failures;
|
174
174
|
}
|
175
|
-
else if (memcmp (tests[i].uncompressed, uncompressed, v) != 0)
|
175
|
+
else if (v > 0 && memcmp (tests[i].uncompressed, uncompressed, v) != 0)
|
176
176
|
{
|
177
177
|
size_t j;
|
178
178
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/* ztest.c -- Test for libbacktrace inflate code.
|
2
|
-
Copyright (C) 2017-
|
2
|
+
Copyright (C) 2017-2024 Free Software Foundation, Inc.
|
3
3
|
Written by Ian Lance Taylor, Google.
|
4
4
|
|
5
5
|
Redistribution and use in source and binary forms, with or without
|
data/ext/pf2/Cargo.toml
CHANGED
@@ -13,7 +13,7 @@ backtrace-sys2 = { path = "../../crates/backtrace-sys2" }
|
|
13
13
|
env_logger = { version = "0.11.0", optional = true }
|
14
14
|
libc = "0.2.149"
|
15
15
|
log = "0.4.20"
|
16
|
-
rb-sys = { version = "0.9.
|
16
|
+
rb-sys = { version = "0.9.105", features = ["stable-api"] }
|
17
17
|
serde = "1.0.189"
|
18
18
|
serde_derive = "1.0.189"
|
19
19
|
serde_json = "1.0.107"
|
@@ -29,11 +29,7 @@ impl ThreadProfile {
|
|
29
29
|
ThreadProfile {
|
30
30
|
thread_id,
|
31
31
|
// The root node
|
32
|
-
stack_tree: StackTreeNode {
|
33
|
-
children: HashMap::new(),
|
34
|
-
node_id: 0,
|
35
|
-
frame_id: 0,
|
36
|
-
},
|
32
|
+
stack_tree: StackTreeNode { children: HashMap::new(), node_id: 0, frame_id: 0 },
|
37
33
|
frame_table: HashMap::new(),
|
38
34
|
samples: vec![],
|
39
35
|
}
|
@@ -91,9 +87,7 @@ impl ProfileSerializer {
|
|
91
87
|
pub fn serialize(profile: &Profile) -> String {
|
92
88
|
let mut sequence = 1;
|
93
89
|
|
94
|
-
let mut serializer = ProfileSerializer {
|
95
|
-
threads: HashMap::new(),
|
96
|
-
};
|
90
|
+
let mut serializer = ProfileSerializer { threads: HashMap::new() };
|
97
91
|
|
98
92
|
unsafe {
|
99
93
|
// Process each sample
|
@@ -222,10 +216,9 @@ impl ProfileSerializer {
|
|
222
216
|
if merged_stack.is_empty() {
|
223
217
|
// This is the leaf node, record a Sample
|
224
218
|
let elapsed_ns = (sample.timestamp - profile.start_instant).as_nanos();
|
225
|
-
thread_serializer
|
226
|
-
|
227
|
-
stack_tree_id: stack_tree.node_id
|
228
|
-
});
|
219
|
+
thread_serializer
|
220
|
+
.samples
|
221
|
+
.push(ProfileSample { elapsed_ns, stack_tree_id: stack_tree.node_id });
|
229
222
|
}
|
230
223
|
|
231
224
|
// Register frame metadata to frame table, if not registered yet
|
data/ext/pf2/src/ringbuffer.rs
CHANGED
@@ -17,9 +17,7 @@ impl Ringbuffer {
|
|
17
17
|
pub fn new(capacity: usize) -> Self {
|
18
18
|
Self {
|
19
19
|
capacity,
|
20
|
-
buffer: std::iter::repeat_with(|| None)
|
21
|
-
.take(capacity + 1)
|
22
|
-
.collect::<Vec<_>>(),
|
20
|
+
buffer: std::iter::repeat_with(|| None).take(capacity + 1).collect::<Vec<_>>(),
|
23
21
|
read_index: 0,
|
24
22
|
write_index: 0,
|
25
23
|
}
|
data/ext/pf2/src/ruby_init.rs
CHANGED
@@ -10,10 +10,7 @@ use crate::util::*;
|
|
10
10
|
extern "C" fn Init_pf2() {
|
11
11
|
#[cfg(feature = "debug")]
|
12
12
|
{
|
13
|
-
env_logger::builder()
|
14
|
-
.format_timestamp(None)
|
15
|
-
.format_module_path(false)
|
16
|
-
.init();
|
13
|
+
env_logger::builder().format_timestamp(None).format_module_path(false).init();
|
17
14
|
}
|
18
15
|
|
19
16
|
unsafe {
|
data/ext/pf2/src/sample.rs
CHANGED
@@ -16,6 +16,7 @@ pub struct Sample {
|
|
16
16
|
/// The stack leading to this sample.
|
17
17
|
/// The leaf node will be stored at `stack[0]`.
|
18
18
|
pub stack: Vec<LocationIndex>,
|
19
|
+
pub native_stack: Vec<LocationIndex>,
|
19
20
|
pub ruby_thread_id: Option<u64>,
|
20
21
|
}
|
21
22
|
|
@@ -42,5 +43,5 @@ pub struct Function {
|
|
42
43
|
#[derive(Clone, PartialEq, Serialize, Deserialize)]
|
43
44
|
pub enum FunctionImplementation {
|
44
45
|
Ruby,
|
45
|
-
|
46
|
+
Native,
|
46
47
|
}
|