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(
3737 execute_data : * mut zend_execute_data ,
3838 return_value : * mut zval ,
3939) -> 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+
4051 let start = Instant :: now ( ) ;
4152
4253 // SAFETY: simple forwarding to original func with original args.
@@ -186,6 +197,10 @@ pub fn timeline_rinit() {
186197 return ;
187198 } ;
188199
200+ if !locals. profiling_experimental_timeline_enabled {
201+ return ;
202+ }
203+
189204 IDLE_SINCE . with ( |cell| {
190205 // try to borrow and bail out if not successful
191206 let Ok ( idle_since) = cell. try_borrow ( ) else {
@@ -230,6 +245,10 @@ pub(crate) fn timeline_mshutdown() {
230245 return ;
231246 } ;
232247
248+ if !locals. profiling_experimental_timeline_enabled {
249+ return ;
250+ }
251+
233252 IDLE_SINCE . with ( |cell| {
234253 // try to borrow and bail out if not successful
235254 let Ok ( idle_since) = cell. try_borrow ( ) else {
You can’t perform that action at this time.
0 commit comments