Commit 296fe519 authored by Robert Lyon's avatar Robert Lyon Committed by Aaron Wells
Browse files

Bug 1517228: perf_to_log function amd misisng data



Because some systems may not have all the available data we should
check if the data exists before trying to display it.

To test:
Before patch change the line in lib/mahara.php
 if (function_exists('posix_times')) {
to
 if (!function_exists('posix_times')) {

and make sure the 'perf_to_log' config option is set to true

This will cause the errors we are trying to deal with to show up

behatnotneeded

Change-Id: If9610fa0eaf4c8bb036b21c1c75e10d828de7934
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
(cherry picked from commit e9584a54)
parent 609ca1af
......@@ -2746,11 +2746,15 @@ function perf_to_log($info=null) {
}
$logstring = 'PERF: ' . strip_querystring(get_script_path()). ': ';
if (isset($info['memory_total']) && isset($info['memory_growth'])) {
$logstring .= ' memory_total: '.$info['memory_total'].'B (' . display_size($info['memory_total']).') memory_growth: '.$info['memory_growth'].'B ('.display_size($info['memory_growth']).')';
}
$logstring .= ' time: '.$info['realtime'].'s';
$logstring .= ' includecount: '.$info['includecount'];
$logstring .= ' dbqueries: '.$info['dbreads'] . ' reads, ' . $info['dbwrites'] . ' writes, ' . $info['dbcached'] . ' cached';
if (isset($info['ticks']) && isset($info['utime']) && isset($info['stime']) && isset($info['cutime']) && isset($info['cstime'])) {
$logstring .= ' ticks: ' . $info['ticks'] . ' user: ' . $info['utime'] . ' sys: ' . $info['stime'] .' cuser: ' . $info['cutime'] . ' csys: ' . $info['cstime'];
}
$logstring .= ' serverload: ' . $info['serverload'];
log_debug($logstring);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment