Skip to content

Commit

Permalink
WIP COMPACTTTT
Browse files Browse the repository at this point in the history
  • Loading branch information
javierhonduco committed Feb 5, 2023
1 parent 049abbd commit c31c0f7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bpf/cpu/cpu.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ int walk_user_stacktrace_impl(struct bpf_perf_event_data *ctx) {
}

// add first
u64 found_pc = unwind_table->rows[table_idx].pc + first_pc;
u64 found_pc = first_pc + unwind_table->rows[table_idx].pc;
u8 found_cfa_type = unwind_table->rows[table_idx].cfa_type;
u8 found_rbp_type = unwind_table->rows[table_idx].rbp_type;
s16 found_cfa_offset = unwind_table->rows[table_idx].cfa_offset;
Expand Down
2 changes: 1 addition & 1 deletion pkg/profiler/cpu/maps.go
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ func (m *bpfMaps) setUnwindTableForMapping(pid int, mapping *unwind.ExecutableMa
// ====================== Write unwind table =====================
for _, row := range currentChunk {
leRow := row
leRow.SetPc(leRow.Pc() - firstPc)
leRow.AdjustPc(firstPc)
if err := m.writeUnwindTableRow(m.unwindInfoBuf, leRow); err != nil {
return fmt.Errorf("writing unwind table row: %w", err)
}
Expand Down
5 changes: 3 additions & 2 deletions pkg/stack/unwind/compact_unwind_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ type CompactUnwindTableRow struct {
rbpOffset int16
}

func (cutr *CompactUnwindTableRow) SetPc(pc uint64) {
cutr.pc = pc
func (cutr *CompactUnwindTableRow) AdjustPc(offset uint64) {
cutr.pc -= offset
// assert that it fits in 32 bits
}

func (cutr *CompactUnwindTableRow) Pc() uint64 {
Expand Down

0 comments on commit c31c0f7

Please sign in to comment.