File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,17 @@ fn try_sleeping_fn(
37
37
execute_data : * mut zend_execute_data ,
38
38
return_value : * mut zval ,
39
39
) -> anyhow:: Result < ( ) > {
40
+ let timeline_enabled = REQUEST_LOCALS . with ( |cell| {
41
+ cell. try_borrow ( )
42
+ . map ( |locals| locals. profiling_experimental_timeline_enabled )
43
+ . unwrap_or ( false )
44
+ } ) ;
45
+
46
+ if !timeline_enabled {
47
+ unsafe { func ( execute_data, return_value) } ;
48
+ return Ok ( ( ) ) ;
49
+ }
50
+
40
51
let start = Instant :: now ( ) ;
41
52
42
53
// SAFETY: simple forwarding to original func with original args.
@@ -186,6 +197,10 @@ pub fn timeline_rinit() {
186
197
return ;
187
198
} ;
188
199
200
+ if !locals. profiling_experimental_timeline_enabled {
201
+ return ;
202
+ }
203
+
189
204
IDLE_SINCE . with ( |cell| {
190
205
// try to borrow and bail out if not successful
191
206
let Ok ( idle_since) = cell. try_borrow ( ) else {
@@ -230,6 +245,10 @@ pub(crate) fn timeline_mshutdown() {
230
245
return ;
231
246
} ;
232
247
248
+ if !locals. profiling_experimental_timeline_enabled {
249
+ return ;
250
+ }
251
+
233
252
IDLE_SINCE . with ( |cell| {
234
253
// try to borrow and bail out if not successful
235
254
let Ok ( idle_since) = cell. try_borrow ( ) else {
You can’t perform that action at this time.
0 commit comments