Using Eclipse's PHP Profiler, I have discovered a bottleneck in my code on a method that is called many times. The problem is that I cannot tell what parameters were passed in to the method to determine how to reproduce the symptom.
I have tried surrounding the code that the profiler is reporting as taking a full second to complete with the following:
$startTime = microtime(true);
$safe_text = wp_check_invalid_utf8( $text );
$endTime = microtime(true);
$time = $endTime - $startTime;
if ($time > .05) {
error_log('Time: ' . $time . ' text [' . $text . ']');
}
I never have a single hit in the error log for this, yet the profiler will continue to report one as taking a full second to complete. Refreshing the page in the browser does indicate that there is significant slowness.
I have this same problem in 3 different areas of my code and knowing what was being passed in to the methods at the time they run slowly may be of assistance in fixing the problem. Is there any way to determine what is being passed in to the intermittently slow method when it is running slowly?