Ejemplo n.º 1
0
$time = array();
$mem = array();
include 'Benchmark.php';
$benchmark = new Benchmark();
if (!empty($_POST)) {
    ob_start();
    foreach ($_POST['code'] as $code) {
        for ($n = 0; $n < $_POST['iterations']; $n++) {
            $benchmark->start();
            eval($code);
            $benchmark->finish();
        }
        $time[] = $benchmark->get_time();
        $mem[] = $benchmark->get_memory();
        $benchmark->flush();
    }
    ob_end_clean();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PHP Benchmark</title>
<style type="text/css">
* { margin:0; padding:0; }
body { font:90% Arial, Helvetica, sans-serif; padding:2em; }
form textarea, form input { font-family:"Courier New", Courier, monospace; }
.block { float:left; }
.block textarea { width:90%; clear:both; }