Skip to content

feat: allow to profile inline functions #2260

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

Open
wants to merge 7 commits into
base: dev
Choose a base branch
from

Conversation

leruaa
Copy link
Contributor

@leruaa leruaa commented Apr 25, 2025

Motivation

It's sometimes useful to be able to have inlines function shown in the call stack when profiling a program

Solution

  • Add a new TRACE_INLINE_FUNCTION env variable to enable inline functions tracking
  • Load inline functions metadata using the DWARF
  • Uses JAL and JALR opcodes to correctly handle recursive functions

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

@leruaa leruaa marked this pull request as draft April 25, 2025 15:47
@leruaa leruaa marked this pull request as ready for review April 28, 2025 15:27
}
let stack_event = match i.opcode {
// A JAL instruction should push the return address onto a return-address
// stack (RAS) only when rd=x1/x5.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// stack (RAS) only when rd=x1/x5.
// stack (RAS) only when rd=x1 or rd=x5.

@ratankaliani ratankaliani requested a review from ctian1 April 30, 2025 01:12
@leruaa leruaa force-pushed the aurelien/gro2-498-add-inlined-functions-to-profiler branch from 16c175a to be86da1 Compare May 1, 2025 12:46
}
}
}

// Pop inline functions when the current PC is not in theirs range
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Pop inline functions when the current PC is not in theirs range
// Pop inline functions when the current PC is not in the range of the function stack.

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.

2 participants