Some added logging

This commit is contained in:
Michael 2017-01-21 20:15:49 +00:00
parent dc439c6e50
commit 69f1deb166
2 changed files with 8 additions and 0 deletions

View File

@ -138,6 +138,11 @@ class dba {
return $return; return $return;
} }
/**
* @brief Analyze a database query and log this if some conditions are met.
*
* @param string $query The database query that will be analyzed
*/
public function log_index($query) { public function log_index($query) {
$a = get_app(); $a = get_app();

View File

@ -179,6 +179,8 @@ function poller_exec_function($queue, $funcname, $argv) {
$stamp = (float)microtime(true); $stamp = (float)microtime(true);
// We use the callstack here to analyze the performance of executed worker entries.
// For this reason the variables have to be initialized.
if (Config::get("system", "profiler")) { if (Config::get("system", "profiler")) {
$a->performance["start"] = microtime(true); $a->performance["start"] = microtime(true);
$a->performance["database"] = 0; $a->performance["database"] = 0;
@ -205,6 +207,7 @@ function poller_exec_function($queue, $funcname, $argv) {
logger("Process ".$mypid." - Prio ".$queue["priority"]." - ID ".$queue["id"].": ".$funcname." - done in ".$duration." seconds."); logger("Process ".$mypid." - Prio ".$queue["priority"]." - ID ".$queue["id"].": ".$funcname." - done in ".$duration." seconds.");
// Write down the performance values into the log
if (Config::get("system", "profiler")) { if (Config::get("system", "profiler")) {
$duration = microtime(true)-$a->performance["start"]; $duration = microtime(true)-$a->performance["start"];