<hr> <small> <?php if (isset($hasControllerActionTime)) { ?> <div>Controller Action Execution Time: <?php echo PHP_Timer::secondsToTimeString(PHP_Timer::stop()); ?> </div> <?php } ?> <div>Execution Time: <?php echo PHP_Timer::timeSinceStartOfRequest(); ?> </div> <?php if (isset($bootstrapTime)) { ?> <div>Application Bootstrap Time: <?php echo $bootstrapTime; ?> </div> <?php } ?> <?php
/** * @covers PHP_Timer::timeSinceStartOfRequest */ public function testTimeSinceStartOfRequest() { $this->assertStringMatchesFormat('%i %s', PHP_Timer::timeSinceStartOfRequest()); }
/** * @param PHPUnit_Framework_TestResult $result */ protected function printFooter(PHPUnit_Framework_TestResult $result) { $this->write(sprintf("\nFinished in %s\n", PHP_Timer::timeSinceStartOfRequest())); $resultsCount = count($result); $footer = sprintf("%d test%s, %d assertion%s", $resultsCount, $resultsCount == 1 ? '' : 's', $this->numAssertions, $this->numAssertions == 1 ? '' : 's'); if ($result->wasSuccessful() && $result->allCompletelyImplemented() && $result->noneSkipped()) { $this->write($this->green($footer)); } else { if ((!$result->allCompletelyImplemented() || !$result->noneSkipped()) && $result->wasSuccessful()) { $footer .= sprintf("%s%s", $this->getCountString($result->notImplementedCount(), 'incomplete'), $this->getCountString($result->skippedCount(), 'skipped')); $this->write($this->yellow($footer)); } else { $footer .= sprintf("%s%s%s%s", $this->getCountString($result->failureCount(), 'failures'), $this->getCountString($result->errorCount(), 'errors'), $this->getCountString($result->notImplementedCount(), 'incomplete'), $this->getCountString($result->skippedCount(), 'skipped')); $footer = preg_replace('/,$/', '', $footer); $this->write($this->red($footer)); } } // if ( ! $this->verbose && // $result->deprecatedFeaturesCount() > 0 ) // { // $message = sprintf( // "Warning: Deprecated PHPUnit features are being used %s times!\n". // "Use --verbose for more information.\n", // $result->deprecatedFeaturesCount() // ); // // if ($this->colors) { // $message = "\x1b[37;41m\x1b[2K" . $message . // "\x1b[0m"; // } // // $this->write("\n" . $message); // } $this->writeNewLine(); }
/** * @param PHPUnit_Framework_TestResult $result */ protected function printFooter(PHPUnit_Framework_TestResult $result) { $this->write(sprintf("\nFinished in %s\n", PHP_Timer::timeSinceStartOfRequest())); $resultsCount = count($result); $footer = sprintf("%d test%s, %d assertion%s", $resultsCount, $resultsCount == 1 ? '' : 's', $this->numAssertions, $this->numAssertions == 1 ? '' : 's'); // backwards/forwards compatibility hack for naming fix from phpunit 3.7.11 // @see https://github.com/sebastianbergmann/phpunit/issues/762 $allCompletelyImplemented = method_exists($result, 'allCompletelyImplemented') ? 'allCompletelyImplemented' : 'allCompletlyImplemented'; if ($result->wasSuccessful() && $result->{$allCompletelyImplemented}() && $result->noneSkipped()) { $this->write($this->green($footer)); } else { if ((!$result->{$allCompletelyImplemented}() || !$result->noneSkipped()) && $result->wasSuccessful()) { $footer .= sprintf("%s%s", $this->getCountString($result->notImplementedCount(), 'incomplete'), $this->getCountString($result->skippedCount(), 'skipped')); $this->write($this->yellow($footer)); } else { $footer .= sprintf("%s%s%s%s", $this->getCountString($result->failureCount(), 'failures'), $this->getCountString($result->errorCount(), 'errors'), $this->getCountString($result->notImplementedCount(), 'incomplete'), $this->getCountString($result->skippedCount(), 'skipped')); $footer = preg_replace('/,$/', '', $footer); $this->write($this->red($footer)); } } if (method_exists($result, 'deprecatedFeaturesCount')) { if (!$this->verbose && $result->deprecatedFeaturesCount() > 0) { $message = sprintf("Warning: Deprecated PHPUnit features are being used %s times!\n" . "Use --verbose for more information.\n", $result->deprecatedFeaturesCount()); if ($this->colors) { $message = "[37;41m[2K" . $message . "[0m"; } $this->write("\n" . $message); } } $this->writeNewLine(); }
$pdo = new PDO($dsn, $dbItem['username'], $dbItem['password']); } catch (\PDOException $e) { throw new \Exception('connect to db failed: [' . $dsn . ']'); } $sql = $query->getSql(); dump($sql); $statement = $pdo->query($sql); $resultSet = $statement->fetchAll(PDO::FETCH_ASSOC); return array_map(function (array $data) { return $data['snsid']; }, $resultSet); } } $options = getopt('', ['concurrency:', 'date:', 'gv:']); $concurrency = isset($options['concurrency']) ? (int) $options['concurrency'] : 100; $gameVersion = isset($options['gv']) ? $options['gv'] : 'tw'; appendLog('game version: ' . $gameVersion . ', concurrency: ' . $concurrency); $base = __DIR__ . '/../../../farm-server-conf/'; assert(is_dir($base)); $esHost = '52.19.73.190'; $esPort = 9200; $esClient = new Client(['hosts' => [sprintf('http://%s:%d/', $esHost, $esPort)]]); //$docUpdater = new DocumentUpdater($esClient, $gameVersion); $docUpdater = new NonBlockingDocUpdater($concurrency); $updater = new UserStatusUpdater($gameVersion); dump($options); $query = array_key_exists('date', $options) ? new AllDeAuthorizedUserQuery($options['date']) : new DeAuthorizedUserQuery(); $resultSet = $updater->run(\Environment\PlatformFactory::make($gameVersion), $query, $docUpdater); dump($resultSet); dump('Run time: ' . PHP_Timer::timeSinceStartOfRequest()); dump(sprintf('Memory: %4.2fMb', memory_get_peak_usage(true) / 1048576));