Skip to content

Commit

Permalink
activate run time cache
Browse files Browse the repository at this point in the history
  • Loading branch information
morrisonlevi committed Mar 8, 2024
1 parent 8d65bce commit c1d7657
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions profiling/benches/stack_walking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@ use datadog_php_profiling::profiling::stalk_walking::collect_stack_sample;

#[cfg(all(target_arch = "x86_64", target_os = "linux"))]
use criterion_perf_events::Perf;
use datadog_php_profiling::profiling::activate_run_time_cache;
#[cfg(all(target_arch = "x86_64", target_os = "linux"))]
use perfcnt::linux::HardwareEventType as Hardware;
#[cfg(all(target_arch = "x86_64", target_os = "linux"))]
use perfcnt::linux::PerfCounterBuilderLinux as Builder;

fn benchmark(c: &mut Criterion) {
let mut group = c.benchmark_group("walk_stack");
#[cfg(php_run_time_cache)]
unsafe {
activate_run_time_cache()
};
group.sampling_mode(SamplingMode::Flat);
for depth in [1, 50, 99].iter() {
let stack = unsafe { zend::ddog_php_test_create_fake_zend_execute_data(99) };
Expand Down
4 changes: 3 additions & 1 deletion profiling/src/profiling/stalk_walking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,9 @@ mod tests {
#[cfg(feature = "stack_walking_tests")]
fn test_collect_stack_sample() {
#[cfg(php_run_time_cache)]
CACHED_STRINGS.with(|cell| cell.new_generation_with_capacity(1024).unwrap());
unsafe {
activate_run_time_cache()
};
unsafe {
let fake_execute_data = zend::ddog_php_test_create_fake_zend_execute_data(3);

Expand Down

0 comments on commit c1d7657

Please sign in to comment.