/** * @todo document */ function wfLogProfilingData() { global $wgRequestTime, $wgDebugLogFile, $wgDebugRawPage, $wgRequest; global $wgProfiling, $wgUser; if ($wgProfiling) { $now = wfTime(); $elapsed = $now - $wgRequestTime; $prof = wfGetProfilingOutput($wgRequestTime, $elapsed); $forward = ''; if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { $forward = ' forwarded for ' . $_SERVER['HTTP_X_FORWARDED_FOR']; } if (!empty($_SERVER['HTTP_CLIENT_IP'])) { $forward .= ' client IP ' . $_SERVER['HTTP_CLIENT_IP']; } if (!empty($_SERVER['HTTP_FROM'])) { $forward .= ' from ' . $_SERVER['HTTP_FROM']; } if ($forward) { $forward = "\t(proxied via {$_SERVER['REMOTE_ADDR']}{$forward})"; } // Don't unstub $wgUser at this late stage just for statistics purposes if (StubObject::isRealObject($wgUser) && $wgUser->isAnon()) { $forward .= ' anon'; } $log = sprintf("%s\t%04.3f\t%s\n", gmdate('YmdHis'), $elapsed, urldecode($_SERVER['REQUEST_URI'] . $forward)); if ('' != $wgDebugLogFile && ($wgRequest->getVal('action') != 'raw' || $wgDebugRawPage)) { error_log($log . $prof, 3, $wgDebugLogFile); } } }
/** * @todo document */ function wfLogProfilingData() { global $wgRequestTime, $wgDebugLogFile, $wgDebugRawPage, $wgRequest; global $wgProfiler, $wgProfileLimit, $wgUser; # Profiling must actually be enabled... if (!isset($wgProfiler)) { return; } # Get total page request time $now = wfTime(); $elapsed = $now - $wgRequestTime; # Only show pages that longer than $wgProfileLimit time (default is 0) if ($elapsed <= $wgProfileLimit) { return; } $prof = wfGetProfilingOutput($wgRequestTime, $elapsed); $forward = ''; if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { $forward = ' forwarded for ' . $_SERVER['HTTP_X_FORWARDED_FOR']; } if (!empty($_SERVER['HTTP_CLIENT_IP'])) { $forward .= ' client IP ' . $_SERVER['HTTP_CLIENT_IP']; } if (!empty($_SERVER['HTTP_FROM'])) { $forward .= ' from ' . $_SERVER['HTTP_FROM']; } if ($forward) { $forward = "\t(proxied via {$_SERVER['REMOTE_ADDR']}{$forward})"; } // Don't unstub $wgUser at this late stage just for statistics purposes if (StubObject::isRealObject($wgUser) && $wgUser->isAnon()) { $forward .= ' anon'; } $log = sprintf("%s\t%04.3f\t%s\n", gmdate('YmdHis'), $elapsed, urldecode($wgRequest->getRequestURL() . $forward)); if ('' != $wgDebugLogFile && ($wgRequest->getVal('action') != 'raw' || $wgDebugRawPage)) { wfErrorLog($log . $prof, $wgDebugLogFile); } }
/** * @todo document */ function logProfilingData() { global $wgRequestTime, $wgDebugLogFile, $wgDebugRawPage, $wgRequest; global $wgProfiling, $wgProfileStack, $wgProfileLimit, $wgUser; $now = wfTime(); list($usec, $sec) = explode(' ', $wgRequestTime); $start = (double) $sec + (double) $usec; $elapsed = $now - $start; if ($wgProfiling) { $prof = wfGetProfilingOutput($start, $elapsed); $forward = ''; if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { $forward = ' forwarded for ' . $_SERVER['HTTP_X_FORWARDED_FOR']; } if (!empty($_SERVER['HTTP_CLIENT_IP'])) { $forward .= ' client IP ' . $_SERVER['HTTP_CLIENT_IP']; } if (!empty($_SERVER['HTTP_FROM'])) { $forward .= ' from ' . $_SERVER['HTTP_FROM']; } if ($forward) { $forward = "\t(proxied via {$_SERVER['REMOTE_ADDR']}{$forward})"; } if ($wgUser->isAnon()) { $forward .= ' anon'; } $log = sprintf("%s\t%04.3f\t%s\n", gmdate('YmdHis'), $elapsed, urldecode($_SERVER['REQUEST_URI'] . $forward)); if ('' != $wgDebugLogFile && ($wgRequest->getVal('action') != 'raw' || $wgDebugRawPage)) { error_log($log . $prof, 3, $wgDebugLogFile); } } }