use jegarn\util\ConvertUtil; require __DIR__ . '/bootstrap.php'; ini_set('default_socket_timeout', -1); if ($argc < 3) { echo "php benchmark.php host port [startUserId] [userCount] [executeTime]\n"; exit(0); } Gbl::$host = $argv[1]; Gbl::$port = intval($argv[2]); Gbl::$uidIndex = isset($argv[3]) ? intval($argv[3]) : 30000; Gbl::$userCount = isset($argv[4]) ? intval($argv[4]) : 10; Gbl::$executeTime = isset($argv[5]) ? intval($argv[5]) : 60; Gbl::init(); // real do for ($i = 0; $i < Gbl::$userCount; ++$i) { $user = Gbl::getUser(); $socket = new Socket(Gbl::$host, Gbl::$port, $user['uid'], $user['account'], $user['password'], $user['groupId'], $user['chatroomId']); if ($socket->connect()) { Gbl::$fpList[] = $socket->fp; Gbl::$socketList[(int) $socket->fp] = $socket; $socket->sendAuthPacket(); } else { echo "[ERROR] connect error user id {$user['uid']}\n"; } } $second = 15; echo "wait {$second} second\n"; sleep($second); $start = time(); echo "go!!!\n"; while (true) {