Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Relicense * Remove old code * Cargo init! + add binary.rs * Add process.rs * Add profile.rs * Compile BPF program * Add bindgen * Add initial binary * Split cli + beginning of error handling changes * Ignore currently generated output * Use libbpf * WIP improvements in stack walking and others * Pass Profile as a mutable argument * Initial support for multiple Ruby versions Including Ruby 3 * Add cpu and syscall subcommands Doesn't implement syscall tracing just yet * Add syscall tracing support * Add integration tests * Various improvements * Move sampling config to the right place * Explicitly set the BPF program type for CPU sampling * Update crates * Use log for logging * Set the initial timestamp just before profiling * Add non-x86 arch warning As it's not being tested that much on arm64 and other architectures so far * Move Ruby ABI configuration to its own file Some day this should be automatically generated with bindgen * Removed hardcoded main thread + ec offsets * Run clippy Some of the ruby_readers helpers were copied / inspired from - https://stackoverflow.com/questions/42066381/how-to-get-a-str-from-a-nul-terminated-byte-slice-if-the-nul-terminator-isnt - https://stackoverflow.com/questions/28127165/how-to-convert-struct-to-u8 * Add program index to rbperf.h and rename read_ruby_frames * Add initial docs * Move bpf to src/bpf * Split dev dependencies + pin the catchall versions * Add more info in Cargo.toml * Append date to output * Fix Ruby 3 stack unwinding Before, we were accessing `ruby_current_vm_ptr.ractor->main_thread->ec`, but turns that, in some cases, perhaps when there's multiple ractors, this execution context is not the one actually running and we should access `ruby_current_vm_ptr.ractor->main_ractor.threads->running_ec` instead. Accessing this member introduces an issue that isn't addressed in this PR. Just before the `threads` field, there's `rb_nativethread_cond_t`[1] which on UNIX platforms is typedef'd to `pthread_cond_t`. In other words, we aren't just depending on Ruby's ABI, but on pthread's as well [1] https://github.com/ruby/ruby/blob/a892e5599ec8ec441a8d8b878efa855ef283ed08/include/ruby/thread_native.h#L38 * Ignore the new output format files * Write flamegraphs as SVGs As they aren't really HTML files and this messes up with the width, too * WIPWIPWIWP more docs * Add server test program running Sinatra + webrick Using webrick as the image builds faster due to the lack of native extensions * Add support for ruby 2.7.6 * Do not read past last frame as don't zero-fill the frames * Add support for Ruby 3.1.2 `rb_control_frame_struct` got an extra field https://github.com/ruby/ruby/blob/08cee2bf804d22dc51002b0df023aea7ec044d8d/vm_core.h#L839 * Ensure that we clean up test processes even on panic * bpf: Fix broken frame count calculation * Initial support for native functions TODO: - Check that this frame is indeed, a native frame - Retrieve funciton's name * Run cargo update * Move Ruby configuration to files This way we will be able to generate these files during build with bindgen, instead of manually generating them! * Improve docs * Link elfutils and zlib statically * Remove unused bcc dependency * tools: Add script to pull the Ruby container images * Test Ruby 2.7.4 * Enable anyhow backtraces in stable Increases the binary size, but it's good to have as much info as we can to debug issues, especially in the beginning :D * Run clang-format `clang-format -i src/bpf/rbperf*` * Add acknowledgements and improve docs a bit * Do not print folded profiles * Set current version to 0.1.0-beta * Add CI
- Loading branch information