-
Notifications
You must be signed in to change notification settings - Fork 375
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3720 from DataDog/ivoanjo/prof-9342-dir-interrupt…
…ion-workaround [PROF-9342] Introduce profiler workaround for Ruby Dir interruption bug
- Loading branch information
Showing
16 changed files
with
988 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Used to quickly run benchmark under RSpec as part of the usual test suite, to validate it didn't bitrot | ||
VALIDATE_BENCHMARK_MODE = ENV['VALIDATE_BENCHMARK'] == 'true' | ||
|
||
return unless __FILE__ == $PROGRAM_NAME || VALIDATE_BENCHMARK_MODE | ||
|
||
require 'benchmark/ips' | ||
require 'datadog' | ||
require 'pry' | ||
require_relative 'dogstatsd_reporter' | ||
|
||
# This benchmark measures the performance of the hold/resume interruptions used by the DirMonkeyPatches | ||
class ProfilerHoldResumeInterruptions | ||
def create_profiler | ||
Datadog.configure do |c| | ||
c.profiling.enabled = true | ||
end | ||
Datadog::Profiling.wait_until_running | ||
end | ||
|
||
def run_benchmark | ||
Benchmark.ips do |x| | ||
benchmark_time = VALIDATE_BENCHMARK_MODE ? { time: 0.01, warmup: 0 } : { time: 10, warmup: 2 } | ||
x.config( | ||
**benchmark_time, | ||
suite: report_to_dogstatsd_if_enabled_via_environment_variable(benchmark_name: 'profiler_hold_resume_interruptions') | ||
) | ||
|
||
x.report("hold / resume") do | ||
Datadog::Profiling::Collectors::CpuAndWallTimeWorker._native_hold_signals | ||
Datadog::Profiling::Collectors::CpuAndWallTimeWorker._native_resume_signals | ||
end | ||
|
||
x.save! 'profiler_hold_resume_interruptions-results.json' unless VALIDATE_BENCHMARK_MODE | ||
x.compare! | ||
end | ||
end | ||
end | ||
|
||
puts "Current pid is #{Process.pid}" | ||
|
||
ProfilerHoldResumeInterruptions.new.instance_exec do | ||
create_profiler | ||
run_benchmark | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.