Last active
October 21, 2015 14:35
-
-
Save joelhandwell/9c5d92ade8233de6a4d2 to your computer and use it in GitHub Desktop.
PHP Speed Profile Recording Syslog Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function do_something1(){ | |
//speed profiling for A | |
$beforeA = microtime(true); | |
executeA(); | |
$afterA = microtime(true); | |
if (($afterA-$beforeA)>400){ | |
$eA = new Exception; | |
syslog(LOG_INFO, "spent ".($afterA-$beforeA).' '.$eA->getTraceAsString(); | |
} | |
} | |
function do_something1(){ | |
//speed pofiling for B | |
$beforeB = microtime(true); | |
executeB(); | |
$afterB = microtime(true); | |
if (($afterB-$beforeB)>400){ | |
$eB = new Exception; | |
syslog(LOG_INFO, "spent ".($afterB-$beforeB).' '.$eB->getTraceAsString(); | |
} | |
//speed profiling for C | |
$beforeC = microtime(true); | |
executeC(); | |
$afterC = microtime(true); | |
if (($afterC-$beforeC)>400){ | |
$eC = new Exception; | |
syslog(LOG_INFO, "spent ".($afterC-$beforeC).' '.$eC->getTraceAsString(); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment