public function __call($name, $args) { if (!in_array($name, array('execute', 'select'))) { return call_user_func_array(array($this->_rdb, $name), $args); } Pluf_Log::stime('timer'); $res = call_user_func_array(array($this->_rdb, $name), $args); Pluf_Log::perf(array('Pluf_DB_Stats', $this->_rdb->lastquery, Pluf_Log::etime('timer', 'total_sql'))); Pluf_Log::inc('sql_query'); return $res; }
/** * End the time to track. * * @param $key Tracker * @param $total Tracker to store the total (null) * @return float Time for this track */ public static function etime($key, $total = null) { $t = microtime(true) - Pluf_Log::$store['time_tracker_' . $key]; if ($total) { Pluf_Log::inc('time_tracker_' . $total, $t); } return $t; }
/** * Run shell_exec and log some information. * * @param $caller Calling method * @param $cmd Command to run * @return string The output */ public static function shell_exec($caller, $cmd) { Pluf_Log::stime('timer'); $ret = shell_exec($cmd); Pluf_Log::perf(array($caller, $cmd, Pluf_Log::etime('timer', 'total_exec'))); Pluf_Log::debug(array($caller, $cmd, $ret)); Pluf_Log::inc('exec_calls'); return $ret; }