diff --git a/bt/includes/init_tr.php b/bt/includes/init_tr.php index cdd0b76c..a109f5ac 100644 --- a/bt/includes/init_tr.php +++ b/bt/includes/init_tr.php @@ -25,7 +25,15 @@ function tracker_exit () $str[] = sprintf('%.4f'. LOG_SEPR .'%02d%%', $DBS->sql_inittime, $sql_init_perc); $str[] = sprintf('%.4f'. LOG_SEPR .'%02d%%', $DBS->sql_timetotal, $sql_total_perc); $str[] = $DBS->num_queries; - $str[] = sprintf('%.1f', sys('la')); + if ($l = sys('la')) + { + $l = explode(' ', $l); + for ($i=0; $i < 3; $i++) + { + $l[$i] = round($l[$i], 1); + } + $str[] = "loadavg: $l[0] $l[1] $l[2]"; + } $str = join(LOG_SEPR, $str) . LOG_LF; dbg_log($str, '!!gentime'); } @@ -414,7 +422,15 @@ class sql_db $msg = round($this->sql_starttime) . LOG_SEPR; $msg .= date('m-d H:i:s', $this->sql_starttime) . LOG_SEPR; $msg .= sprintf('%-6s', $q_time); - $msg .= LOG_SEPR . sprintf('%-4s', round(sys('la'), 1)); + if ($l = sys('la')) + { + $l = explode(' ', $l); + for ($i=0; $i < 3; $i++) + { + $l[$i] = round($l[$i], 1); + } + $msg .= LOG_SEPR . "loadavg: $l[0] $l[1] $l[2]"; + } $msg .= LOG_SEPR . sprintf('%05d', getmypid()); $msg .= LOG_SEPR . $this->db_server; $msg .= LOG_SEPR . str_compact($this->cur_query); diff --git a/library/includes/core/mysql.php b/library/includes/core/mysql.php index 93037174..0711187a 100644 --- a/library/includes/core/mysql.php +++ b/library/includes/core/mysql.php @@ -855,7 +855,15 @@ class sql_db $msg[] = round($this->sql_starttime); $msg[] = date('m-d H:i:s', $this->sql_starttime); $msg[] = sprintf('%-6s', $q_time); - $msg[] = sprintf('%-4s', round(sys('la'), 1)); + if ($l = sys('la')) + { + $l = explode(' ', $l); + for ($i=0; $i < 3; $i++) + { + $l[$i] = round($l[$i], 1); + } + $msg[] = "loadavg: $l[0] $l[1] $l[2]"; + } $msg[] = sprintf('%05d', getmypid()); $msg[] = $this->db_server; $msg[] = short_query($this->cur_query); diff --git a/library/includes/cron/cron_run.php b/library/includes/cron/cron_run.php index 45660da8..caff8538 100644 --- a/library/includes/cron/cron_run.php +++ b/library/includes/cron/cron_run.php @@ -48,7 +48,15 @@ foreach ($cron_jobs as $job) $msg[] = 'start'; $msg[] = date('m-d'); $msg[] = date('H:i:s'); - $msg[] = sprintf('%-4s', round(sys('la'), 1)); + if ($l = sys('la')) + { + $l = explode(' ', $l); + for ($i=0; $i < 3; $i++) + { + $l[$i] = round($l[$i], 1); + } + $msg[] = "loadavg: $l[0] $l[1] $l[2]"; + } $msg[] = sprintf('%05d', getmypid()); $msg[] = $job['cron_title']; $msg = join(LOG_SEPR, $msg); @@ -75,7 +83,15 @@ foreach ($cron_jobs as $job) $msg[] = ' end'; $msg[] = date('m-d'); $msg[] = date('H:i:s'); - $msg[] = sprintf('%-4s', round(sys('la'), 1)); + if ($l = sys('la')) + { + $l = explode(' ', $l); + for ($i=0; $i < 3; $i++) + { + $l[$i] = round($l[$i], 1); + } + $msg[] = "loadavg: $l[0] $l[1] $l[2]"; + } $msg[] = sprintf('%05d', getmypid()); $msg[] = round(utime() - $cron_start_time) .'/'. round(utime() - TIMESTART) . ' sec'; $msg = join(LOG_SEPR, $msg); @@ -126,4 +142,4 @@ foreach ($cron_jobs as $job) $cron_err_msg = "Can not run \"{$job['cron_title']}\" : file \"$job_script\" not found". LOG_LF; bb_log($cron_err_msg, 'cron_error'); } -} \ No newline at end of file +}