Skip to content

Conversation

@pull
Copy link

@pull pull bot commented Jul 18, 2022

See Commits and Changes for more details.


Created by pull[bot]

Can you help keep this open source service alive? 💖 Please sponsor : )

genya0407 and others added 6 commits September 20, 2021 17:42
Even though this use of MD5 isn't for security purposes, MD5 may not
be allowed at all on FIPS-compliant systems. Switch to SHA256 to
comply with FIPS 140-2 standards.
Fix: #179

YJIT doesn't support being interrupted by signal
in random places, and probably will never support it.
Use postponed jobs if YJIT is enabled.
@pull pull bot added the ⤵️ pull label Jul 18, 2022
tenderlove and others added 23 commits July 26, 2022 09:51
Use postponed jobs on Ruby 2.x
Support installing the gem on TruffleRuby
Switch hash algorithm from MD5 to SHA256
…megraph

Show line number in d3-flamegraph
Sometime when you want to profile a ruby process for its entire
lifetime, it's a bit complicated to find the proper entrypoint and
exit point to insert `StackProf.start` etc.

This new CLI command allows to do this easily, e.g:

```bash
$ stackprof run -- rubocop --cache false
StackProf results dumped at: /var/folders/pg/ykz6j94s7dv_2z4l5x_m17l00000gn/T/stackprof20220914-26008-7iipjc.dump
```

Or for profiling a Rails application boot sequence:

```bash
$ stackprof run -- bin/rails runner ':ok'
```

The most common `StackProf.start` arguments can be passed as command
line arguments as well.
Forward SIGALRM to original thread
Signed-off-by: Aaron Patterson <tenderlove@ruby-lang.org>
Otherwise it can cause a VM crash.
Won't be a problem in 3.2.1.
Ensure VM is running in signal handler
tenderlove and others added 30 commits March 20, 2023 09:14
Objects in frames_buffer may not have been placed the frames ST table
and may not be held on by Ruby meaning it could get garbage collected.
Restore pre-C99 compatibility.
This commit removes mocha and cleans up some assertions.  I want to
reduce the dependencies and get CI green
Remove mocha / clean up assertions
This commit records line numbers in raw mode along with the frame
information.

Before this commit, stackprof would lose information about callee frames
at a particular line.  For example, you could not answer "given a frame
and line, what function do we call in to at that line?"  This commit
encodes the line information along with the raw frame information so
that we can answer that question.

This is probably TMI, but when we ask the Ruby frame profiler, it
returns a list of memory addresses (CMEs or possibly iseqs?).  AArch64
systems guarantee the top 16 bits won't be used, x86 doesn't use them
either (but possibly could in the future, but probably not). Armed with
this information, we just put the line number in those top 16 bits and
we don't need to allocate any extra memory when doing a profile.

For backwards compatibility, this patch splits apart the information in
the `.result` method so existing tools should just work.
Add raw line numbers for raw mode
We were recording GC profile timestamps inside the VM postponed job that
flushes temporary information.  The postponed job could be run much
later than the sample was actually taken, so this commit records a
timestamp in the signal handler when there is a GC event.

It only records one time stamp, so if there are multiple GC events in a
row, we have to assume that the total duration spent in GC starts from
the first time stamp and extends until the timestamp of the next non-GC
sample.  In other words, we don't record a correct timestamp for each GC
sample, only the first one.
Don't use postponed jobs on Ruby 3.3+YJIT
It's a single object so not really worth implementing write barriers
or any other advanced features.

The only goal here is to stop using a deprecated API.
fix crashes with not-yet fully-initialized stackprof global state
Read only first two bytes to check signature
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.