Skip to content

Commit 3647506

Browse files
committed
reformat and remove is_timeline_enabled guard
1 parent f27da46 commit 3647506

File tree

1 file changed

+25
-32
lines changed

1 file changed

+25
-32
lines changed

profiling/src/profiling/mod.rs

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -955,8 +955,7 @@ impl Profiler {
955955
alloc_size: i64,
956956
interrupt_count: Option<u32>,
957957
) {
958-
let (result, _wall_time, _cpu_time) =
959-
self.collect_stack_sample_with_timeline(execute_data);
958+
let (result, _wall_time, _cpu_time) = self.collect_stack_sample_with_timeline(execute_data);
960959
match result {
961960
Ok(frames) => {
962961
let depth = frames.len();
@@ -1009,8 +1008,7 @@ impl Profiler {
10091008
exception: String,
10101009
message: Option<String>,
10111010
) {
1012-
let (result, _wall_time, _cpu_time) =
1013-
self.collect_stack_sample_with_timeline(execute_data);
1011+
let (result, _wall_time, _cpu_time) = self.collect_stack_sample_with_timeline(execute_data);
10141012
match result {
10151013
Ok(frames) => {
10161014
let depth = frames.len();
@@ -1410,8 +1408,7 @@ impl Profiler {
14101408
where
14111409
F: FnOnce(&mut SampleValues),
14121410
{
1413-
let (result, _wall_time, _cpu_time) =
1414-
self.collect_stack_sample_with_timeline(execute_data);
1411+
let (result, _wall_time, _cpu_time) = self.collect_stack_sample_with_timeline(execute_data);
14151412
match result {
14161413
Ok(frames) => {
14171414
let depth = frames.len();
@@ -1555,32 +1552,28 @@ impl Profiler {
15551552
let (stack_walk_wall_time, stack_walk_cpu_time) =
15561553
CLOCKS.with_borrow_mut(Clocks::rotate_clocks);
15571554

1558-
if self.is_timeline_enabled() {
1559-
if let Ok(now) = SystemTime::now().duration_since(UNIX_EPOCH) {
1560-
let timestamp = now.as_nanos() as i64;
1561-
let labels = Profiler::common_labels(0);
1562-
let n_labels = labels.len();
1563-
match self.prepare_and_send_message(
1564-
vec![ZendFrame {
1565-
function: COW_PROFILER_STACK_WALK,
1566-
file: None,
1567-
line: 0,
1568-
}],
1569-
SampleValues {
1570-
wall_time: stack_walk_wall_time,
1571-
cpu_time: stack_walk_cpu_time,
1572-
..Default::default()
1573-
},
1574-
labels,
1575-
timestamp,
1576-
) {
1577-
Ok(_) => {
1578-
trace!("Sent stack walk sample with {n_labels} labels to profiler.")
1579-
}
1580-
Err(err) => warn!(
1581-
"Failed to send stack walk sample with {n_labels} labels to profiler: {err}"
1582-
),
1583-
}
1555+
let timestamp = self.get_timeline_timestamp();
1556+
let labels = Profiler::common_labels(0);
1557+
let n_labels = labels.len();
1558+
match self.prepare_and_send_message(
1559+
vec![ZendFrame {
1560+
function: COW_PROFILER_STACK_WALK,
1561+
file: None,
1562+
line: 0,
1563+
}],
1564+
SampleValues {
1565+
wall_time: stack_walk_wall_time,
1566+
cpu_time: stack_walk_cpu_time,
1567+
..Default::default()
1568+
},
1569+
labels,
1570+
timestamp,
1571+
) {
1572+
Ok(_) => {
1573+
trace!("Sent stack walk sample with {n_labels} labels to profiler.")
1574+
}
1575+
Err(err) => {
1576+
warn!("Failed to send stack walk sample with {n_labels} labels to profiler: {err}")
15841577
}
15851578
}
15861579

0 commit comments

Comments
 (0)