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

[PROF-4198] Gather CPU time in profiler without monkey patching Thread for all supported Ruby versions (2.1 to 3.x) #1740

Merged
merged 14 commits into from
Nov 5, 2021

Commits on Oct 27, 2021

  1. Enable gathering thread CPU time using native extension for legacy Ru…

    …by < 2.6
    
    By relying on the `debase-ruby_core_source` extension, we can get access
    to the internal VM headers needed to implement this functionality on
    all legacy Ruby versions we support.
    
    Note that this does not yet change the profiler to use
    `NativeExtension.clock_id_for` on these older Rubies.
    ivoanjo committed Oct 27, 2021
    Configuration menu
    Copy the full SHA
    2d6e9c5 View commit details
    Browse the repository at this point in the history
  2. Introduce NativeExtension#cpu_time_ns_for helper

    This abstracts away the actual operation we want in our code -- getting
    the cpu time for a given thread, rather than exposing the clock_id
    and having callers handle it.
    ivoanjo committed Oct 27, 2021
    Configuration menu
    Copy the full SHA
    a9f9354 View commit details
    Browse the repository at this point in the history
  3. Sample cpu time in Stack sampler using native extension directly

    We now gather cpu time directly using the native extension, rather
    than relying on the `cthread.rb` monkey patch.
    
    This allows us to remove `cthread.rb` (next commit), as well as to
    clean up the whole "let's try to detect when there's missing
    instrumentation" approach we had going on.
    
    It also enables us to simpify the tests. All great advantages!
    ivoanjo committed Oct 27, 2021
    Configuration menu
    Copy the full SHA
    87c9676 View commit details
    Browse the repository at this point in the history
  4. Copy Process::Waiter comments and regression tests over from cthread.rb

    We want to preserve this knowledge and tests, so before deleting
    `cthread.rb` and its spec, let's move this to the stack sampler.
    ivoanjo committed Oct 27, 2021
    Configuration menu
    Copy the full SHA
    2ce9dc4 View commit details
    Browse the repository at this point in the history
  5. Remove all references to the CPU extension from the Setup task

    After we move CPU time to use the native extension, we no longer need
    the "CPU extension" that monkey patches `Thread` creation.
    ivoanjo committed Oct 27, 2021
    Configuration menu
    Copy the full SHA
    50ad4f5 View commit details
    Browse the repository at this point in the history
  6. Remove all references to the CPU time extension aka Thread monkey patch

    It's been fully replaced by our usage of the native extension to get
    this information.
    ivoanjo committed Oct 27, 2021
    Configuration menu
    Copy the full SHA
    1106b71 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    09dd419 View commit details
    Browse the repository at this point in the history
  8. Drop ffi dependency

    `ffi` was only used by the profiling CPU time extension (`cthread.rb`)
    which has been removed so let's get rid of it. Thanks `ffi` for your
    service.
    ivoanjo committed Oct 27, 2021
    Configuration menu
    Copy the full SHA
    e85f017 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    9a77c61 View commit details
    Browse the repository at this point in the history
  10. Skip native extension build testing for Windows+ruby-head

    We still have a lot of other Windows-related failures, so let's get
    back to this once 3.1 is released.
    ivoanjo committed Oct 27, 2021
    Configuration menu
    Copy the full SHA
    eb8ff20 View commit details
    Browse the repository at this point in the history
  11. Workaround for Ruby 2.1 not having a public thread_native.h header

    Hopefully we can deprecate Ruby 2.1 soon.
    ivoanjo committed Oct 27, 2021
    Configuration menu
    Copy the full SHA
    b47bdbb View commit details
    Browse the repository at this point in the history
  12. Add missing test assertions

    ivoanjo committed Oct 27, 2021
    Configuration menu
    Copy the full SHA
    e1c4fa3 View commit details
    Browse the repository at this point in the history

Commits on Oct 28, 2021

  1. Configuration menu
    Copy the full SHA
    0f7eeae View commit details
    Browse the repository at this point in the history

Commits on Nov 5, 2021

  1. Configuration menu
    Copy the full SHA
    4725cc6 View commit details
    Browse the repository at this point in the history