function print_games_summary($dataArr, $zc = 0)
{
    $tbl_struct = array(array("label" => "Game", "bold" => 1), array("label" => "Total Instances", "align" => "right"), array("label" => "DAU", "align" => "right"), array("label" => "DAU per Instance", "align" => "right"), array("label" => "RPS<sup>1</sup>", "align" => "right"), array("label" => "Cost per User<sup>2</sup>", "align" => "right"), array("label" => "Optimal Instance <br/> count<sup>3</sup>", "align" => "right"), array("label" => "% Slack", "align" => "right"), array("label" => "Status<sup>4</sup>"));
    global $server_cfg;
    if (isset($server_cfg["hostname"])) {
        $hostname = $server_cfg["hostname"];
    } else {
        $hostname = "xxxx.xxxx.xxx";
    }
    $tbl_data = array();
    $i = 0;
    foreach ($dataArr as $game => $data) {
        if (isset($_GET['static'])) {
            $date = date('dm');
            $game_detail_link = "<a href='http://{$hostname}/zperfmon/report/static/{$date}/{$game}.html'>{$game}</a>";
        } else {
            $game_detail_link = "<a href='instance-detail-report.php?game={$game}'>{$game}</a>";
        }
        $status = get_game_status($data["dau_per_instance"], $zc);
        $tbl_data[$i][] = $game_detail_link;
        //game name
        $tbl_data[$i][] = number_format($data["count"]);
        //instances
        $tbl_data[$i][] = number_format($data["dau"]);
        //dau
        $tbl_data[$i][] = number_format($data["dau_per_instance"]);
        $tbl_data[$i][] = format_rps($data["rps"], $zc);
        $tbl_data[$i][] = $data["cost_per_user"];
        //		$tbl_data[$i][] = number_format($data["optimal_instance_count"]); //recommended instance count
        $tbl_data[$i][] = "-";
        $tbl_data[$i][] = number_format($data["slack"], 2) . "%";
        //% slack
        $tbl_data[$i][] = $status;
        $i++;
    }
    $markup = ReportTableMarkup::get_table_markup($tbl_struct, $tbl_data);
    echo $markup;
}
function print_instances_type_details()
{
    $tbl_struct = array(array("label" => "Instance Type", "bold" => 1), array("label" => "Total Instances", "align" => "right"), array("label" => "Optimal Instance <br/> count<sup>2</sup>", "align" => "right"), array("label" => "% Slack<sup>3</sup>", "align" => "right"));
    $tbl_data = array();
    global $instance_util_obj;
    $instances = $instance_util_obj->get_instance_type_data();
    $instances = sort_by_instance_count($instances);
    $i = 0;
    foreach ($instances as $type => $data) {
        if ($data["count"] == null || $data["count"] == 0) {
            //if instance count is 0, don't show in report
            continue;
        }
        if ($data["optimal_instance_count"] == 0) {
            $optimal_count = NA;
            $slack = NA;
        } else {
            $slack = number_format(($data["count"] - $data["optimal_instance_count"]) * 100 / $data["count"], 2) . "%";
            $optimal_count = number_format($data["optimal_instance_count"]);
        }
        $tbl_data[$i][] = $type;
        $tbl_data[$i][] = number_format($data["count"]);
        $tbl_data[$i][] = $optimal_count;
        $tbl_data[$i][] = format_slack($slack);
        $i++;
    }
    $markup = ReportTableMarkup::get_table_markup($tbl_struct, $tbl_data);
    echo $markup;
}
Example #3
0
function get_eu_markup($eu, $summary = 0)
{
    $tbl_struct = array(array("label" => "&nbsp;", "align" => "left", "bold" => 1), array("label" => "Today", "align" => "right"), array("label" => "Yesterday", "align" => "right"), array("label" => "Last week", "align" => "right"));
    global $reportData;
    global $keyMap;
    $data = array();
    $keys = $keyMap[$eu];
    for ($i = 0; $i < sizeof($keys); $i++) {
        $tbl_data[$i] = array();
        $tbl_data[$i][0] = $keys[$i]["label"];
        $key = $keys[$i]["key"];
        $j = 1;
        foreach ($reportData[$eu] as $day => $data) {
            if ($summary == 1) {
                $tbl_data[$i][$j] = round_up($data["avg"][$key]);
            } else {
                $tbl_struct[$j]["minmax"] = 1;
                if ($eu == "web_eu") {
                    $avg = round_up($data["avg"][$key] * 100);
                    $min = round_up($data["min"][$key] * 100);
                    $max = round_up($data["max"][$key] * 100);
                } else {
                    $avg = round_up($data["avg"][$key]);
                    $min = round_up($data["min"][$key]);
                    $max = round_up($data["max"][$key]);
                }
                $tbl_data[$i][$j] = array("avg" => $avg, "min" => $min, "max" => $max);
            }
            $j++;
        }
    }
    return ReportTableMarkup::get_table_markup($tbl_struct, $tbl_data);
}