} } pathmunge("../src"); #$pause = 1000000; $pause = 0; ini_set("memory_limit", "1M"); error_reporting(E_ALL); require "plot-timeline.php"; // init new plotter $plot = new plot_timeline(); $plot->log("set up logging"); ############################################################################### usleep(round(rand() * $pause / getrandmax())); $plot->log("closing and reopening plotter"); // now to test plotter aggregation $plot->saveData("func.txt"); unset($plot); // init new plotter $plot = new plot_timeline(); $plot->loadData("func.txt"); // use relative paths and log to stdout only $plot->log("reinstated plotter, " . $plot->entries() . " entries"); ############################################################################### usleep(round(rand() * $pause / getrandmax())); $plot->log("testing custom message coloration"); $color = 0xffffff; for ($i = 0; $i < 15; $i++) { if ($i > 0) { usleep(round($pause / 1000)); } $plot->log("color test iteration {$i}, color 0x" . dechex($color), $color);
$h = $w = 100; $a = 100; $b = 100; $c = 100; $d = 100; require "dejong.fast.php"; unset($renderfile); $plot->log("returned from dejong.fast.php"); ############################################################################### // make some more data require "test.php"; $plot->log("returned from test.php"); ############################################################################### // now to test plotter aggregation $plot->log("closing and reopening plotter", 0x7f7f7f); $plot->saveData("data.txt"); unset($plot); // init new plotter $plot = new plot_timeline(); $plot->loadData("data.txt"); $plot->log("reinstated plotter, " . $plot->entries() . " entries", 0x7f7f7f); ############################################################################### $h = $w = 64; $a = $b = $c = $d = 3; require "dejong.php"; $plot->log("returned from dejong.php"); ############################################################################### // make some more data require "test.php"; $plot->log("returned from test.php"); ###############################################################################
if ($point - $pointprev > imagefontheight($fontsize) * 2) { imagestring($im, $fontsize, $xoffset + 3, $midpoint - imagefontheight($fontsize) / 2, self::return_human($data[$y]['time']), $fontcolor); } } } unset($point, $mul, $xoffset, $pointprev, $midpoint); // posix times? if (array_key_exists("posix_times", $rawdata)) { $x = 400 + imagefontwidth($fontsize); imagestring($im, $fontsize, $x, $y * imagefontheight($fontsize), "time breakdown: ", $fontcolor); $x += 16 * imagefontwidth($fontsize); imagestring($im, $fontsize, $x, $y * imagefontheight($fontsize), "system: " . self::approx_round($rawdata["posix_times"]["stime"] / 100) . "s", $sys_color); $x += (strlen(self::approx_round($rawdata["posix_times"]["stime"] / 100)) + 10) * imagefontwidth($fontsize); imagestring($im, $fontsize, $x, $y * imagefontheight($fontsize), "user: "******"posix_times"]["utime"] / 100) . "s", $user_color); $x += (strlen(self::approx_round($rawdata["posix_times"]["utime"] / 100)) + 8) * imagefontwidth($fontsize); imagestring($im, $fontsize, $x, $y * imagefontheight($fontsize), "real: " . self::approx_round($data[count($data) - 1]["time"]) . "s", $fontcolor); $y++; } unset($user_color, $sys_color, $data, $rawdata, $x); imagestring($im, $fontsize, 400 + imagefontwidth($fontsize), $y * imagefontheight($fontsize), $memory_size, $fontcolor); $y++; unset($fontsize, $fontcolor, $memory_size, $y); $this->render = $im; } } // include argv if we were called directly if (isset($argv) && basename($argv[0]) == basename(__FILE__)) { $p = new plot_timeline(); plot_timeline::req($argv[1]); $p->saveData('data.txt'); }