From 74f80970c55c9bf87c47f8f0773a3b1caaf32dc4 Mon Sep 17 00:00:00 2001 From: Alexandre Fonseca Date: Fri, 23 Feb 2024 12:51:53 +0000 Subject: [PATCH] [PROF-8669] Benchmarks for heap profiling --- .gitlab/benchmarks.yml | 19 +++++++++++++++++++ .../profiler_memory_sample_serialize.rb | 8 +++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.gitlab/benchmarks.yml b/.gitlab/benchmarks.yml index 9cad18ea033..ec65a21109c 100644 --- a/.gitlab/benchmarks.yml +++ b/.gitlab/benchmarks.yml @@ -90,6 +90,25 @@ only-profiling-alloc: DD_PROFILING_NO_SIGNALS_WORKAROUND_ENABLED: "false" DD_PROFILING_EXPERIMENTAL_ALLOCATION_ENABLED: "true" +only-profiling-heap: + extends: .benchmarks + variables: + DD_BENCHMARKS_CONFIGURATION: only-profiling + DD_PROFILING_ENABLED: "true" + DD_PROFILING_NO_SIGNALS_WORKAROUND_ENABLED: "false" + DD_PROFILING_EXPERIMENTAL_ALLOCATION_ENABLED: "true" + DD_PROFILING_EXPERIMENTAL_HEAP_ENABLED: "true" + +only-profiling-heap-size: + extends: .benchmarks + variables: + DD_BENCHMARKS_CONFIGURATION: only-profiling + DD_PROFILING_ENABLED: "true" + DD_PROFILING_NO_SIGNALS_WORKAROUND_ENABLED: "false" + DD_PROFILING_EXPERIMENTAL_ALLOCATION_ENABLED: "true" + DD_PROFILING_EXPERIMENTAL_HEAP_ENABLED: "true" + DD_PROFILING_EXPERIMENTAL_HEAP_SIZE_ENABLED: "true" + profiling-and-tracing: extends: .benchmarks variables: diff --git a/benchmarks/profiler_memory_sample_serialize.rb b/benchmarks/profiler_memory_sample_serialize.rb index af0a14dbe07..1573774eecd 100644 --- a/benchmarks/profiler_memory_sample_serialize.rb +++ b/benchmarks/profiler_memory_sample_serialize.rb @@ -42,11 +42,13 @@ def sample_object(recorder, depth = 0) class ProfilerMemorySampleSerializeBenchmark def create_profiler + @heap_samples_enabled = ENV['HEAP_SAMPLES'] == 'true' + @heap_size_enabled = ENV['HEAP_SIZE'] == 'true' @recorder = Datadog::Profiling::StackRecorder.new( cpu_time_enabled: false, alloc_samples_enabled: true, - heap_samples_enabled: false, - heap_size_enabled: false, + heap_samples_enabled: @heap_samples_enabled, + heap_size_enabled: @heap_size_enabled, heap_sample_every: 1, timeline_enabled: false, ) @@ -60,7 +62,7 @@ def run_benchmark suite: report_to_dogstatsd_if_enabled_via_environment_variable(benchmark_name: 'profiler_memory_sample_serialize') ) - x.report("sample+serialize #{ENV['CONFIG']}") do + x.report("sample+serialize #{ENV['CONFIG']} heap_samples=#{@heap_samples_enabled} heap_size=#{@heap_size_enabled}") do samples_per_second = 100 simulate_seconds = 60