Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace BFD with libelf, rework IP-resolution, decrease unkown function rate significantly, add support for DWARF and debuginfod #351

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

cvonelm
Copy link
Member

@cvonelm cvonelm commented Nov 7, 2024

Replace BFD -> libelf, merge MMap class and ProcessInfo, split

function and instruction resolution.

-> split function resolution and instruction resolution

-> integrate mmap code into ProcessInfo

The mmap code is not used outside of ProcessInfo and every function
in ProcessInfo was already a paper thin wrapper around something in Mmap

-> replace binutils/libbfd with elfutils/libdw/libelf

- API usable by human beings
- Actual documentation
- Has support for DWARF
- 

Simplify calling context managment, include timepoint tracking

-> rename ref stuff

All the stuff just being reference numbers in OTF2 underneath is such
an unimportant implementation detail. rename it to "LocalCctx"
"GlobalCctx". This way it becomes clear that we first generate local
calling contexts in every sample::Writer and then map them to the global
calling contexts later on in post processing.

-> simplify calling context tracking

most of it was needlessly complex, as we don't need to record context in
most cases we simply have it.

-> use Mmap2 Record format instead of mmap2

according to the perf_event_open man page, RecordMmap does not support adding the
sample_id fields, such as the event timestamp to RecordMmap events, only
to RecordMmap2 events, so change to the latest and greatest format.

-> introduce exec and mmap event timestamp tracking

Keep track of execs and when memory mappings happen by time.

Currently, lo2s does process tracking solely by pid. This approach
failes in the context of execs, where instruction pointer 0xc0ffee can
refer to one thing before the exec and to something different altogether
after the exec.

We now can differentiate between different processes sharing the same
pid over time.

However, one important part is still missing, time tracking for
instruction pointers. This is programmatically the hard part.

But for now this at least makes the common case (fork() then immediate
exec()) work better.

-> simplify cctx tracking

Track Thread CCTX (used for calling context enter/leave events)
separately from Instruction Pointer CCTx (used for calling context
sample events). Remove a layer of indirection. Track instruction
pointers per process instead of per thread. (Threads can not have
different memory images.

Move event definitions to include/perf/types.hpp

Not everything that wants to interact with perf events is a derived
class of EventReader, such as the process memory map handling code. So,
move relevant event definitions into neutral ground.

Not everything that wants to interact with perf events is a derived
class of EventReader, such as the process memory map handling code. So,
move relevant event definitions into neutral ground.
-> rename ref stuff

All the stuff just being reference numbers in OTF2 underneath is such
an unimportant implementation detail. rename it to "LocalCctx"
"GlobalCctx". This way it becomes clear that we first generate local
calling contexts in every sample::Writer and then map them to the global
calling contexts later on in post processing.

-> simplify calling context tracking

most of it was needlessly complex, as we don't need to record context in
most cases we simply have it.

-> use Mmap2 Record format instead of mmap2

according to the perf_event_open man page, RecordMmap does not support adding the
sample_id fields, such as the event timestamp to RecordMmap events, only
to RecordMmap2 events, so change to the latest and greatest format.

-> introduce exec and mmap event timestamp tracking

Keep track of execs and when memory mappings happen by time.

Currently, lo2s does process tracking solely by pid. This approach
failes in the context of execs, where instruction pointer 0xc0ffee can
refer to one thing before the exec and to something different altogether
after the exec.

We now can differentiate between different processes sharing the same
pid over time.

However, one important part is still missing, time tracking for
instruction pointers. This is programmatically the hard part.

But for now this at least makes the common case (fork() then immediate
exec()) work better.

-> simplify cctx tracking

Track Thread CCTX (used for calling context enter/leave events)
separately from Instruction Pointer CCTx (used for calling context
sample events). Remove a layer of indirection. Track instruction
pointers per process instead of per thread. (Threads can not have
different memory images.
@cvonelm cvonelm force-pushed the libdw branch 4 times, most recently from 61198b6 to c4403c6 Compare November 7, 2024 13:16
function and instruction resolution.

-> split function resolution and instruction resolution

-> integrate mmap code into ProcessInfo

The mmap code is not used outside of ProcessInfo and every function
in ProcessInfo was already a paper thin wrapper around something in Mmap

-> replace binutils/libbfd with elfutils/libdw/libelf

- API usable by human beings
- Actual documentation
- Has support for DWARF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant