Exemplo n.º 1
0
$stopper = new Stopper();
while (!$gotWhatWeCameFor) {
    for ($i = 0; $i <= SAMPLING_CYCLES; $i++) {
        # get long delta
        try {
            $stopper->start();
            $Zbot->uploadFile(str_repeat('A', 180) . ".dat", str_repeat('A', 9990) . rand_str(10));
            $stopper->stop();
            print "\n[L] {$i}:" . $stopper->getDelta();
            $longStats->addVar($stopper->getDelta());
            # get short delta
            $stopper->start();
            $Zbot->uploadFile(rand_str($i) . ".dat", str_repeat('A', 9990) . rand_str(10));
            $stopper->stop();
            print "\n[S] {$i}:" . $stopper->getDelta();
            $shortStats->addVar($stopper->getDelta());
        } catch (Exception $e) {
            $i--;
            print "\n[X] " . $e->getMessage();
        }
    }
    # clean records who are above the standard deviation time and calc average again
    $newVars = array();
    foreach ($longStats->getVars() as $var) {
        if ($var < $longStats->calcAverage() + $longStats->calcStdDeviation()) {
            array_push($newVars, $var);
            continue;
        }
        print "\n[!] excluding the value {$var} from long response time statistics";
    }
    $longStats->setVars($newVars);