function print_dau_summary()
{
    global $instance_util_obj;
    $dau = $instance_util_obj->get_dau();
    $instances = $instance_util_obj->get_instances_detail_data();
    $total_cost = 0;
    $total_instances = 0;
    foreach ($instances as $class => $data) {
        $total_cost += $data["cost"];
        $total_instances += $data["count"];
    }
    $cost_per_user = round($total_cost / $dau, 4);
    $dau_per_instance = round($dau / $total_instances);
    $markup = get_game_status($dau_per_instance);
    $markup .= "<div><b>DAU:</b> " . number_format($dau) . "</div>";
    $markup .= "<div><b>DAU per Instance:<sup>1</sup></b> " . format_dau_per_instance($dau_per_instance) . "</div>";
    //$markup .= "<div><b>Cost per user:</b> $$cost_per_user per day</div>";
    $markup .= "<br/>";
    echo $markup;
}
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;
}
Example #3
0
<?php

/*
 * Copyright 2009 MiTH.  All Rights Reserved. 
 *
 * Application: MiTH (Mafia in The House)
 * File: 'group.php'
 */
require_once 'mithkeys.php';
$user_id = $facebook->api_client->users_getLoggedInUser();
get_game_status($game_id);
//TODO get the list of people who have accepted and who have not.