コード例 #1
0
function DoPHPTests()
{
    global $PHPtotaltime;
    global $testmathresult;
    global $teststringresult;
    global $testloopresult;
    global $testifelseresult;
    echo "<table width=70%>\n";
    echo "<tr><td valign='top'><B>PHP test:</b></td></tr>\n";
    $PHPtotaltime = 0;
    $testmathresult = test_Math();
    $PHPtotaltime = $PHPtotaltime + $testmathresult;
    echo "<tr><td valign='top' width=20%>Time to perform: </td><td valign='top' width=58%><font color='blue'><b> Math test</b></font></td><td valign='top' width=22%> :" . sprintf("%6.2f", $testmathresult) . " seconds</td></tr>\n";
    //
    $teststringresult = test_StringManipulation();
    $PHPtotaltime = $PHPtotaltime + $teststringresult;
    echo "<tr><td valign='top'>Time to perform: </td><td valign='top'><font color='blue'><b> StringManipulation test</b></font></td><td valign='top'> :" . sprintf("%6.2f", $teststringresult) . " seconds</td></tr>\n";
    //
    $testloopresult = test_Loops();
    $PHPtotaltime = $PHPtotaltime + $testloopresult;
    echo "<tr><td valign='top'>Time to perform: </td><td valign='top'><font color='blue'><b> test Loop test</b></font></td><td valign='top'> :" . sprintf("%6.2f", $testloopresult) . " seconds</td></tr>\n";
    //
    $testifelseresult = test_IfElse();
    $PHPtotaltime = $PHPtotaltime + $testifelseresult;
    echo "<tr><td valign='top'>Time to perform: </td><td valign='top'><font color='blue'><b>  test IfElse</b></font></td><td valign='top'> :" . sprintf("%6.2f", $testifelseresult) . " seconds</td></tr>\n";
    echo "<tr><td valign='top'>Total time</td><td valign='top'><b>(all PHP tests)</td><td valign='top'> :<font color='blue'><b>" . sprintf("%6.2f", $PHPtotaltime) . "</b></font> seconds</td></tr></table>\n";
}
コード例 #2
0
ファイル: index.php プロジェクト: muhammedzaimtr/speedtest
$start = $time[0] + $time[1];
for ($x = 0; $x < $kb; $x++) {
    echo str_pad('', 1024, '.');
    flush();
}
/* muhammed zaim*/
$time = explode(" ", microtime());
$finish = $time[0] + $time[1];
$deltat = $finish - $start;
echo "-> Execution speed is - " . round($kb / $deltat, 3) . "Kb/s";
echo "<table class='table'>";
echo "<tr>";
echo "<td>Execution time </td><td> {$time_overall} sec</td>";
echo "</tr>";
echo "<tr>";
echo "<td>StringManipulation Time </td><td>" . test_StringManipulation() . " sec</td>";
echo "</tr>";
echo "<tr>";
echo "<td>Loops</td><td>" . test_Loops() . " sec</td>";
echo "</tr>";
echo "<tr>";
echo "<td>Math Functions </td><td>" . test_Math() . " sec</td>";
echo "</tr>";
echo "<tr>";
echo "<td>IfElse Conditions </td><td>" . test_IfElse() . " sec</td>";
echo "</tr>";
echo "</table>";
/* muhammed zaim*/
echo "</b>";
?>
<div id="dumdiv" align="center" style="font-size: 10px;color: #dadada;">