function print_table($table, $server_cfg, $game, $ts) { $prof_path_prefix = sprintf($server_cfg["root_upload_directory"] . "%s/xhprof", $game, $ts); foreach ($table as $prof => $row) { echo "<tr class=\"gradeA\">\n"; $page_parts = explode(":", basename($prof)); $page = $page_parts[3]; $tod = date("Y/m/d G:i:s", $page_parts[1]); $prof_path = sprintf("%s/%s/%s", $prof_path_prefix, $page_parts[2], $prof); echo "<td><a href=\"" . get_prof_link($prof_path, $server_cfg) . "\" target=\"{$page}\">"; // echo "$tod, $page</a></td>\n"; echo "{$page}</a></td>\n"; for ($i = 1; $i <= 5; $i++) { echo sprintf("<td>%s</td><td>%d</td>", $row["n{$i}"], $row["v{$i}"]); } echo "\n</tr>\n"; } }
function htmlize_ip_dir($server_cfg) { list($prof_path, $game, $ts) = get_path($server_cfg); echo "<html><head><title>{$prof_path}</title></head>\n"; echo "<body>\n"; echo get_day_list($server_cfg, $game, $ts); echo "<table border=1>\n"; $profiles = glob($prof_path . "/*.xhprof"); echo "<tr><td>Profile</td><td></td><td>Wall Time</td><td>CPU Time</td><td>Mem Util</td><td>Peak Mem</td></tr>\n"; foreach ($profiles as $prof) { $prof_parts = explode(".", basename($prof)); unset($prof_parts[-1]); $tod = date("Y/m/d G:i:s", $prof_parts[0] * 1800); unset($prof_parts[0]); $page = implode(".", $prof_parts); echo "<tr><td><a href=\"" . get_prof_link($prof, $server_cfg) . "\">{$tod}, {$page}</a></td>"; echo "<td><a href=\"" . get_raw_link($prof, $server_cfg) . "\">raw</a></td>"; $smry = get_summary($prof); foreach (array("wt", "cpu", "pmu", "mu") as $metric) { $v = ${$metric} = (int) $smry[$metric]; echo "<td align=\"right\">{$v}</td>"; } echo "</tr>\n"; } echo "</table>\n</body>\n"; echo "</html>"; }