/**
  * @param ZcDb $db
  * @param array $args
  */
 public function afterSetCache($db, $args)
 {
     $cacheSetTime = bcsub(ZcNumberHelper::microtimeFloat(self::SCALE), $this->cacheSetStartTime, self::SCALE);
     $this->cacheSetStats[] = array($args, $cacheSetTime);
 }
示例#2
0
文件: zc.php 项目: wuyuanyuan1012/zc
 public static function G($start = '', $end = '', $dec = 3)
 {
     if (empty($_GET['need_stat'])) {
         return false;
     }
     static $_info = array();
     if (is_float($end)) {
         $info[$start] = $end;
     } elseif (!empty($end)) {
         if (!isset($_info[$end])) {
             $_info[$end] = ZcNumberHelper::microtimeFloat(3);
         }
         return number_format($_info[$end] - $_info[$start], $dec);
     } elseif (!empty($start)) {
         $_info[$start] = ZcNumberHelper::microtimeFloat(3);
     } else {
         $temp = array();
         $findFirst = true;
         foreach ($_info as $key => $value) {
             if ($findFirst) {
                 $baseTime = $value;
                 $lastTime = 0;
                 $findFirst = false;
             }
             $currTime = bcsub($value, $baseTime, 3);
             $currCostTime = bcsub($currTime, $lastTime, 3);
             $lastTime = $currTime;
             $temp[$key] = $currTime . ' [' . $currCostTime . ']';
         }
         return $temp;
     }
 }