Skip to content

Commit 87a33e6

Browse files
add thread_id label in case of ZTS
1 parent ffeeba8 commit 87a33e6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

profiling/src/profiling/mod.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,7 @@ impl Profiler {
10111011
fn prepare_sample_message(
10121012
frames: Vec<ZendFrame>,
10131013
samples: SampleValues,
1014-
#[cfg(php_has_fibers)] mut labels: Vec<Label>,
1014+
#[cfg(any(php_has_fibers, php_zts))] mut labels: Vec<Label>,
10151015
#[cfg(not(php_has_fibers))] labels: Vec<Label>,
10161016
locals: &RequestLocals,
10171017
timestamp: i64,
@@ -1081,6 +1081,12 @@ impl Profiler {
10811081
}
10821082
}
10831083

1084+
#[cfg(php_zts)]
1085+
labels.push(Label {
1086+
key: "thread id",
1087+
value: LabelValue::Num(unsafe { libc::pthread_self() as i64 }, "id".into()),
1088+
});
1089+
10841090
let tags = TAGS.with(|cell| Arc::clone(&cell.borrow()));
10851091

10861092
SampleMessage {

0 commit comments

Comments
 (0)