Skip to content

Commit

Permalink
if profiling is disabled, we do not need any other checks
Browse files Browse the repository at this point in the history
  • Loading branch information
realFlowControl committed Dec 22, 2023
1 parent 7c4c9e5 commit bb260e2
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions profiling/src/profiling/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1046,38 +1046,38 @@ impl Profiler {
let len = 2 + locals.profiling_experimental_cpu_time_enabled as usize;
sample_types.extend_from_slice(&SAMPLE_TYPES[0..len]);
sample_values.extend_from_slice(&values[0..len]);
}

// alloc-samples, alloc-size
if locals.profiling_allocation_enabled {
sample_types.extend_from_slice(&SAMPLE_TYPES[3..5]);
sample_values.extend_from_slice(&values[3..5]);
}
// alloc-samples, alloc-size
if locals.profiling_allocation_enabled {
sample_types.extend_from_slice(&SAMPLE_TYPES[3..5]);
sample_values.extend_from_slice(&values[3..5]);
}

#[cfg(feature = "timeline")]
if locals.profiling_experimental_timeline_enabled {
sample_types.push(SAMPLE_TYPES[5]);
sample_values.push(values[5]);
}
#[cfg(feature = "timeline")]
if locals.profiling_experimental_timeline_enabled {
sample_types.push(SAMPLE_TYPES[5]);
sample_values.push(values[5]);
}

#[cfg(feature = "exception_profiling")]
if locals.profiling_exception_enabled {
sample_types.push(SAMPLE_TYPES[6]);
sample_values.push(values[6]);
}
#[cfg(feature = "exception_profiling")]
if locals.profiling_exception_enabled {
sample_types.push(SAMPLE_TYPES[6]);
sample_values.push(values[6]);
}

#[cfg(php_has_fibers)]
if let Some(fiber) = unsafe { ddog_php_prof_get_active_fiber().as_mut() } {
// Safety: the fcc is set by Fiber::__construct as part of zpp,
// which will always set the function_handler on success, and
// there's nothing changing that value in all of fibers
// afterwards, from start to destruction of the fiber itself.
let func = unsafe { &*fiber.fci_cache.function_handler };
if let Some(functionname) = extract_function_name(func) {
labels.push(Label {
key: "fiber",
value: LabelValue::Str(functionname.into()),
});
#[cfg(php_has_fibers)]
if let Some(fiber) = unsafe { ddog_php_prof_get_active_fiber().as_mut() } {
// Safety: the fcc is set by Fiber::__construct as part of zpp,
// which will always set the function_handler on success, and
// there's nothing changing that value in all of fibers
// afterwards, from start to destruction of the fiber itself.
let func = unsafe { &*fiber.fci_cache.function_handler };
if let Some(functionname) = extract_function_name(func) {
labels.push(Label {
key: "fiber",
value: LabelValue::Str(functionname.into()),
});
}
}
}

Expand Down

0 comments on commit bb260e2

Please sign in to comment.