计算运行时间

@param int $mode
@return mixed
774405
public static function runtime($mode = 0)
    {
        static $t;
        if(!$mode) {
            $t = microtime();
        } else {
            $t1 = microtime();
            list($m0,$s0) = explode(" ",$t);
            list($m1,$s1) = explode(" ",$t1);
            return ($s1+$m1-$s0-$m0) * 1000;
        }
    }
17412
public function switchMode( $mode ) {
		$this->mode = $mode;
		$this->handler = $this->dispatchTable[$mode];
		return $this->handler;
	}
674116
public static function get_class_for_mode($mode) {
        switch ($mode) {
            case cache_store::MODE_APPLICATION :
                return 'cache_application';
            case cache_store::MODE_REQUEST :
                return 'cache_request';
            case cache_store::MODE_SESSION :
                return 'cache_session';
        }
        throw new coding_exception('Unknown cache mode passed. Must be one of cache_store::MODE_*');
    }
150230
public function count($mode = COUNT_NORMAL)
    {
        if($mode == COUNT_RECURSIVE)
        {
            $count = 0;
            $data  = $this->__options;
            foreach ($data as $key => $value)
            {
                if(is_array($value) || $value instanceof ObjectConfig)
                {
                    if ($value instanceof ObjectConfigInterface) {
                        $count += $value->count($mode);
                    } else {
                        $count += count($value);
                    }
                }
            }
        }
        else $count = count($this->__options);

        return $count;
    }
702322
public function open($mode = 'a') {
        if (is_resource($this->stream)) {
            return $this;
        }
        $this->stream = fopen($this->file->getFullName(), $mode);
        return $this;
    }
553830
public function makeFile($mode = FileSystemPermission::NORMAL)
    {
        $file = $this->factory->makeFile($mode);
        $this->container->add($file);

        return $file;
    }
786517
public function mrecv($mode = 0)
    {
        if ($this->verbose) {
            $this->getLogger()->debug('PRE RECV: '.$this->id);
        }
        $data = array();
        while (true) {
            $data[] = $this->recv($mode);
            if (!$this->getSockOpt(ZMQ::SOCKOPT_RCVMORE)) {
                break;
            }
        }

        $message = new Message($data);
        if ($this->verbose) {
            $this->getLogger()->debug('RECV: '.$this->id);
            $this->getLogger()->debug($message);
        }

        if (ZMQ::SOCKET_ROUTER === $this->getSocketType()) {
            $message->stripRoutingInformation();
        }

        return $message;
    }
886880
public function count($mode = null)
    {
        if ($this->data == null) {
            $ret = $this->client->get($this->url, $this->query);
            $this->data = $ret->getData();
        }
        return (int) ($this->data['_total_items'] ?? $this->data['total_items'] ?? 0);
    }
739338
function run($num=1)
    {
        //初始化事件系统
        if (!($this->protocol instanceof Swoole\Server\UDP_Server_Protocol))
        {
            return error(902);
        }
        //建立服务器端Socket
        $this->server_sock = $this->create("udp://{$this->host}:{$this->port}");
        stream_set_blocking($this->server_sock,$this->server_block);
        $this->server_socket_id = (int)$this->server_sock;
        //设置事件监听，监听到服务器端socket可读，则有连接请求
        $this->protocol->onStart();
        $this->server_loop();
    }
716480
public function mode($mode = null)
    {
        if (func_num_args() === 0) {
            return $this->_mode;
        }
        $this->_mode = $mode;
        return $this;
    }
993022
private function setHandle($mode)
    {
        $this->closeExistingHandle();

        $this->handle = fopen($this->file, $mode);

        return $this->handle;
    }
1096550
public function run($id)
    {
        /* @var $model \yii\db\ActiveRecord */
        $model = call_user_func([$this->modelClass, 'findOne'], $id);
        if(empty($model)){
            return $this->controller->redirect($this->directView);
        }
        $this->viewFile === null && $this->viewFile = $this->id;
        return $this->controller->render($this->viewFile, [
            'model' => $model,
        ]);
    }
643640
public function create($mode = 0777) {

		if(false === ('-' . intval($mode) == '-' . $mode)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type integer, "%s" given', __METHOD__, gettype($mode)), E_USER_ERROR);
		}

		$paths = preg_split('#[\\/]#', $this -> directory -> getPath());
		$build = '';

		foreach($paths as $path) {

			$build .= $path . DIRECTORY_SEPARATOR;

			if(false === @is_dir($build)) {
				@mkdir($build, $mode);
			}
		}

		$this -> refresh();

		return $this;
	}
537104
public function append($mode = 'min')
    {
        if ($mode === 'dev')
        {
            var_dump($this->buffer);
        }
        else if ($mode === 'prod')
        {
            // TODO: 実装
        }
        else if ($mode === 'min')
        {
            echo implode('', $this->buffer);
        }
    }
1211634
public function queryScalar($mode = null)
    {
        $result = $this->query(null, $mode);

        if (is_array($result)) {
            // Filter by values
            $result = array_values($result);
            return isset($result[0]) ? $result[0] : false;
        }

        return false;
    }
920339
public function action($mode, $args = [])
    {
        if (!$this->persistence) {
            throw new Exception(['action() requires model to be associated with db']);
        }

        if (!$this->persistence->hasMethod('action')) {
            throw new Exception('Persistence does not support action()');
        }

        return $this->persistence->action($this, $mode, $args);
    }
481214
public function count($mode = COUNT_NORMAL)
    {
        if($mode == COUNT_RECURSIVE)
        {
            $count = 0;
            $data  = $this->__options;
            foreach ($data as $key => $value)
            {
                if(is_array($value) || $value instanceof KObjectConfig)
                {
                    if ($value instanceof KObjectConfigInterface) {
                        $count += $value->count($mode);
                    } else {
                        $count += count($value);
                    }
                }
            }
        }
        else $count = count($this->__options);

        return $count;
    }