function _simplenews_measure_usec in Simplenews 7.2
Same name and namespace in other branches
- 6.2 includes/simplenews.mail.inc \_simplenews_measure_usec()
- 6 simplenews.module \_simplenews_measure_usec()
- 7 includes/simplenews.mail.inc \_simplenews_measure_usec()
Helper function to measure PHP execution time in microseconds.
Parameters
bool $start: If TRUE, reset the time and start counting.
Return value
float The elapsed PHP execution time since the last start.
1 call to _simplenews_measure_usec()
- simplenews_mail_spool in includes/
simplenews.mail.inc - Send simplenews newsletters from the spool.
File
- includes/
simplenews.mail.inc, line 778 - Simplenews email send and spool handling
Code
function _simplenews_measure_usec($start = FALSE) {
// Windows systems don't implement getrusage(). There is no alternative.
if (!function_exists('getrusage')) {
return;
}
$start_time =& drupal_static(__FUNCTION__);
$usage = getrusage();
$now = (double) ($usage['ru_stime.tv_sec'] . '.' . $usage['ru_stime.tv_usec']) + (double) ($usage['ru_utime.tv_sec'] . '.' . $usage['ru_utime.tv_usec']);
if ($start) {
$start_time = $now;
return;
}
return $now - $start_time;
}