public function testReset() { $timer = new SystemTimer(); usleep(2 * $this->TEST_TIME * 1000 * 1000); $timer->reset(); usleep($this->TEST_TIME * 1000 * 1000); $time = $timer->getElapsedTime(); $this->assertEquals($this->TEST_TIME, $time, "", 0.01); }
public static function getInstance() { if (!isset(self::$instance)) { self::$instance = new Statistics(SystemTimer::getInstance()); } return self::$instance; }
public static function getInstance() { if (!isset(self::$instance)) { $config = FajrConfigLoader::getConfiguration(); $type = $config->get(FajrConfigOptions::DEBUG_TRACE); $uniqueID = sha1(uniqid('trace', true)); $header = 'Trace (id: ' . $uniqueID . ')'; $tags = array('unique-id' => $uniqueID); if ($type === FajrConfigOptions::DEBUG_TRACE_NONE) { self::$instance = new NullTrace(); } else { if ($type === FajrConfigOptions::DEBUG_TRACE_ARRAY) { self::$instance = new ArrayTrace(SystemTimer::getInstance(), $header); } else { // File-based trace $traceDir = $config->getDirectory(FajrConfigOptions::DEBUG_TRACE_DIR); if ($traceDir === null) { throw new \LogicException(FajrConfigOptions::DEBUG_TRACE_DIR . ' is not set, but is required for file-based traces'); } $ext = $type == FajrConfigOptions::DEBUG_TRACE_TEXT ? 'txt' : 'bin'; $filename = FajrUtils::joinPath($traceDir, 'trace' . $uniqueID . '.' . $ext); $file = @fopen($filename, 'ab'); if ($file === false) { throw new \Exception('Cannot open trace file'); } if ($type == FajrConfigOptions::DEBUG_TRACE_TEXT) { self::$instance = new FileTrace(SystemTimer::getInstance(), $file, 0, $header); } else { self::$instance = new BinaryFileTrace(SystemTimer::getInstance(), $file, $header, $tags); } } } } return self::$instance; }
<p> <strong>Dôležité:</strong> Pred používaním aplikácie je ešte nutné správne nastaviť skupinu na <code>www-data</code> (alebo pod čím beží webserver) a práva na adresáre <code>./temp</code>, <code>./temp/cookies</code> a <code>./temp/sessions</code> (alebo na tie, čo ste nastavili v konfigurácii), tak, aby boli nastavené práva len na zapisovanie a použitie , t.j. <code>d----wx---</code>. </p> '); } $config = FajrConfigLoader::getConfiguration(); if ($config->get(FajrConfigOptions::REQUIRE_SSL) && !FajrUtils::isHTTPS()) { fajr_bootstrap_error(' <p> Pre túto inštanciu fajr-u je vyžadované HTTPS spojenie. Prosím skontrolujte prepisovacie pravidlá v <code>.htaccess</code> (alebo konfigurácii web servera), ktoré presmerovávajú HTTP spojenia na HTTPS. Ak nechcete vyžadovať SSL spojenie, je možné túto kontrolu vypnúť v konfiguračnom súbore, <strong>avšak na produkčných inštaláciách, alebo inštaláciách s funkčným SSL sa neodporúča túto kontrolu vypínať. </strong> </p> '); } // bootstrapping whole application // TODO: DEBUG_EXCEPTION_SHOWSTACKTRACE sa nejako vytratilo... SystemTimer::setInitialTime($startTime); $fajr = new Fajr($config); $fajr->run(); session_write_close();