• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP load_game_config函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中load_game_config函数的典型用法代码示例。如果您正苦于以下问题:PHP load_game_config函数的具体用法?PHP load_game_config怎么用?PHP load_game_config使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了load_game_config函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: modify_hostgroup_in_db

function modify_hostgroup_in_db($final_array)
{
    global $server_cfg, $game;
    foreach ($final_array as $regex => $config) {
        if (!isset($config["class"])) {
            $final_array[$regex] = "";
        }
    }
    $conf_all = parse_ini_file($server_cfg["rs_conf_file"], true);
    $conf = $conf_all["DB"];
    $db_server = $conf["host"];
    $db_user = $conf["user"];
    $db_pass = $conf["password"];
    $db_name = $conf["database"];
    $mysql_pdo = new PDO("mysql:host={$db_server};dbname={$db_name}", $db_user, $db_pass);
    if (!$mysql_pdo) {
        print "Failed to create new mysql PDO\n";
        return 1;
    }
    $game_cfg = load_game_config($game);
    $deploy_id = $game_cfg["deployIDs"][0];
    foreach ($final_array as $regex => $metric) {
        $mysql_regex = str_replace(".*", "%", $regex);
        $hostgroup = $metric['hostgroup'];
        $query = "update instances set hostgroup='{$hostgroup}' where hostname like '{$mysql_regex}' and deploy_id={$deploy_id}";
        $stmt = $mysql_pdo->prepare($query);
        $stmt->execute();
    }
}
开发者ID:shourya07,项目名称:zperfmon,代码行数:29,代码来源:dump_file.php


示例2: main

function main($server_cfg)
{
    $options = get_options();
    if (isset($options['g']) && $options['g'] !== '') {
        $game_names = explode(",", $options['g']);
    } else {
        $game_names = $server_cfg['game_list'];
    }
    foreach ($game_names as $game) {
        zpm_preamble($game);
        $game_cfg = load_game_config($game);
        $retval = null;
        // refs will start failing in 5.3.x if not declared
        $cleanup = "/usr/local/zperfmon/bin/clean.sh -g " . $game_cfg['name'] . " > /dev/null ";
        $output = system($cleanup, $retval);
        if ($retval != 0) {
            error_log("Couldn`t cleanup game {$game}", 3, sprintf($server_cfg['log_file'], $game_cfg['name']));
            continue;
        }
        $arrays_to_id = get_array_id_map($server_cfg, $game_cfg);
        foreach ($arrays_to_id as $array => $id) {
            $game_cfg = load_game_config($game, $id);
            $cleanup = "/usr/local/zperfmon/bin/clean.sh -g " . $game_cfg['name'] . " > /dev/null ";
            $output = system($cleanup, $retval);
            if ($retval != 0) {
                error_log("Couldn`t cleanup game {$game}", 3, sprintf($server_cfg['log_file'], $game_cfg['name']));
                continue;
            }
        }
        zpm_postamble($game);
    }
}
开发者ID:shourya07,项目名称:zperfmon,代码行数:32,代码来源:clean.php


示例3: main

function main($server_cfg)
{
    if (isset($_GET['game'])) {
        $game = $_GET['game'];
    } else {
        echo "Game name is invalid or not set \n";
        exit;
    }
    $game_cfg = load_game_config($game);
    $deploy_id = $game_cfg["deployIDs"][0];
    # Getting the distinct hostgroups for the inputed game
    $conf_all = parse_ini_file($server_cfg["rs_conf_file"], true);
    $conf = $conf_all["DB"];
    $db_server = $conf["host"];
    $db_user = $conf["user"];
    $db_pass = $conf["password"];
    $db_name = $conf["database"];
    $mysql_pdo = new PDO("mysql:host={$db_server};dbname={$db_name}", $db_user, $db_pass);
    if (!$mysql_pdo) {
        print "Failed to create new mysql PDO\n";
        return 1;
    }
    $regex = $_GET["regex"];
    $regex = str_replace(".*", '%', $regex);
    $query = "select hostname from instances where hostname like '{$regex}' and deploy_id={$deploy_id}";
    $stmt = $mysql_pdo->prepare($query);
    $stmt->execute();
    $hosts = $stmt->fetchAll(PDO::FETCH_ASSOC);
    $count_hostnames = array();
    foreach ($hosts as $value) {
        $count_hostnames["hosts"][] = $value["hostname"];
    }
    $count_hostnames["count"] = count($count_hostnames["hosts"]);
    echo json_encode($count_hostnames);
}
开发者ID:shourya07,项目名称:zperfmon,代码行数:35,代码来源:fetch_hosts.php


示例4: extract_functions

function extract_functions($files, $game_name, $run_id, $aggregate_dir)
{
    // XXX: xhprof depends on this global for doing entry counts
    global $display_calls;
    $display_calls = true;
    $functions_to_extract = array("MC::set", "MC::get", "ApcManager::get", "ApcManager::set", "serialize", "unserialize", "AMFBaseSerializer::serialize", "AMFBaseDeserializer::deserialize");
    if ($game_cfg = load_game_config($game_name)) {
        //$game_cfg = $game_cfg[$game_name];
        if (isset($game_cfg["tracked_functions"])) {
            $functions_to_extract = $game_cfg["tracked_functions"];
        }
    }
    $prof_obj = new XHProfRuns_Default();
    $runs = xhprof_aggregate_runs_list($prof_obj, $files);
    if ($runs['raw']) {
        $aggregate = $runs['raw'];
    } else {
        return;
    }
    # keep this in sync with the aggregate_files
    # $aggregate_file_name = "{$run_id}.xhprof";
    $overall_totals = null;
    $flattened_profile = xhprof_compute_flat_info($aggregate, $overall_totals);
    $interesting_funcs = extract_interesting_functions($flattened_profile, $functions_to_extract);
    $top_funcs = get_top_functions($flattened_profile, 5);
    $xhprof = array("interesting" => $interesting_funcs, "top functions" => $top_funcs, "files" => $files);
    file_put_contents("{$aggregate_dir}/{$run_id}.extract", serialize($xhprof));
}
开发者ID:shourya07,项目名称:zperfmon,代码行数:28,代码来源:aggregate.php


示例5: get_pie

function get_pie($game_name, $period = "day", $tstamp = null, $metrics = array("excl_wt" => "Exclusive Wall time", "excl_cpu" => "Exclusive CPU time"), $how_many = 6, $profile = null)
{
    global $server_cfg;
    $game_cfg = load_game_config($game_name);
    //$game_cfg = $game_cfg["$game_name"];
    if ($profile != null) {
        $period = "absolute";
    }
    switch ($period) {
        case "day":
            $prof_path = sprintf($server_cfg["daily_profile"], $game_cfg["name"]);
            break;
        case "30min":
            $prof_path = sprintf($server_cfg["daily_upload_directory"], $game_cfg["name"]);
            break;
        case "absolute":
            break;
        default:
            echo "Unsupported period \\'{$period}\\' for get_pie()";
            error_log("Unsupported period \\'{$period}\\' for get_pie()");
            return null;
    }
    if ($period != "absolute") {
        // Find all aggregate profiles in dir and take the last
        $profile_list = glob("{$prof_path}/*all.xhprof");
        if (empty($profile_list)) {
            echo "no profile in {$period} {$prof_path}/*.all.xhprof";
            return null;
        }
        $profile = end($profile_list);
    }
    return get_top_functions($profile, $metrics, $how_many);
}
开发者ID:shourya07,项目名称:zperfmon,代码行数:33,代码来源:profilepie.inc.php


示例6: main

function main($server_cfg)
{
    $options = get_options($server_cfg);
    foreach ($options['games'] as $game) {
        zpm_preamble($game);
        $game_cfg = load_game_config($game);
        if (!$game_cfg) {
            error_log("Daily job: Failed to load config for {$game}\n", 3, sprintf($server_cfg['log_file'], $game));
            continue;
        }
        // log_file and logger object are used by all child functions.
        $game_cfg['log_file'] = sprintf($server_cfg['log_file'], $game);
        $game_cfg['logger'] = new Logger($server_cfg, $game_cfg);
        $job = $options['job'];
        if ($job == "both" or $job == "daily") {
            process_daily($server_cfg, $game_cfg, $options['timeslot'], $options['period']);
        }
        //performance report
        /*
        		if ($job == "both" or $job == "report") {
        			generate_report($server_cfg, $game_cfg,
        					$options['timeslot'], $options['period']);
        		}*/
        zpm_postamble($game);
    }
}
开发者ID:shourya07,项目名称:zperfmon,代码行数:26,代码来源:daily_job.php


示例7: main

function main($server_cfg)
{
    $options = get_options($server_cfg);
    foreach ($options['games'] as $game) {
        zpm_preamble($game);
        $game_cfg = load_game_config($game);
        if (!$game_cfg) {
            error_log("Daily job: Failed to load config for {$game}\n", 3, sprintf($server_cfg['log_file'], $game));
            continue;
        }
        // log_file and logger object are used by all child functions.
        $game_cfg['log_file'] = sprintf($server_cfg['log_file'], $game);
        $game_cfg['logger'] = new Logger($server_cfg, $game_cfg);
        $job = $options['job'];
        //instance detail report per game
        if ($job == "both" or $job == "report") {
            InstanceReport::generate_detail_report($server_cfg, $game_cfg, $options['timeslot'], $options['period']);
        }
        zpm_postamble($game);
    }
    //instance summary report for all games
    $job = $options['job'];
    if ($job == "both" or $job == "report") {
        InstanceReport::generate_summary_report($server_cfg, $options['timeslot'], $options['period']);
    }
}
开发者ID:shourya07,项目名称:zperfmon,代码行数:26,代码来源:daily_instance_report_job.php


示例8: get_config_file

 public function get_config_file($game)
 {
     $game_cfg = load_game_config($game);
     if (isset($game_cfg['cloud_name']) && $game_cfg['cloud_name'] == 'zcloud') {
         return $this->server_cfg['common_config_zcloud_file'];
     } else {
         return $this->server_cfg['common_config_file'];
     }
 }
开发者ID:shourya07,项目名称:zperfmon,代码行数:9,代码来源:yml_conf.inc.php


示例9: scan_game_cfgs

function scan_game_cfgs($server_cfg)
{
    $map = array();
    foreach ($server_cfg["game_list"] as $game) {
        $gcfg = load_game_config($game);
        $deploy_id = $gcfg['deployIDs'][0];
        $map[$deploy_id] = $game;
    }
    return $map;
}
开发者ID:shourya07,项目名称:zperfmon,代码行数:10,代码来源:game_deploy_map.php


示例10: get_ips

 private function get_ips()
 {
     $this->game_cfg = load_game_config($this->game);
     $deploy_id = $this->game_cfg['deployIDs'][0];
     $query = "select array_id, private_ip from instances where deploy_id={$deploy_id} and array_id != 0";
     $stmt = $this->prepare($query);
     if ($stmt) {
         $result = $this->fetchAll($stmt, array());
         foreach ($result as $item) {
             $array_id = $item['array_id'];
             $this->ip_list[$array_id][] = $item['private_ip'];
         }
     }
 }
开发者ID:shourya07,项目名称:zperfmon,代码行数:14,代码来源:xhprof_update.php


示例11: splitarraywise

function splitarraywise($server_cfg, $ip_list, $game_name, $time_slot)
{
    $game_cfg = load_game_config($game_name);
    $rs = new RightScale($server_cfg, $game_cfg);
    $mapping = $rs->get_array_ip_mapping();
    $return = array();
    foreach ($ip_list as $ip) {
        $dir_base_path = sprintf($server_cfg["root_upload_directory"], $game_name);
        $base_ip_dir = $dir_base_path . $time_slot . "/" . $server_cfg['profile_upload_directory'];
        $ip_dir = $base_ip_dir . "/" . $ip;
        //$filelist = scandir($ip_dir);
        $array_id = $mapping[$ip];
        // To prevent game_ folder to be created due to 5 minute processing
        if (!isset($array_id) || $array_id == '') {
            continue;
        }
        $return[$array_id][] = $ip;
        $dir_base_path_array = sprintf($server_cfg["root_upload_directory"], $game_name . "_" . $array_id);
        //creating the timeslot directory
        if (!is_dir($dir_base_path_array . $time_slot)) {
            mkdir($dir_base_path_array . $time_slot, 0777, true);
        }
        //creating the xhprof directory
        if (!is_dir($dir_base_path_array . $time_slot . "/" . $server_cfg['profile_upload_directory'])) {
            mkdir($dir_base_path_array . $time_slot . "/" . $server_cfg['profile_upload_directory'], 0777, true);
        }
        $base_ip_dir_array = $dir_base_path_array . $time_slot . "/" . $server_cfg['profile_upload_directory'];
        $ip_directory_array = $base_ip_dir_array . "/" . $ip;
        // Check if symlink exists already. In case of frequent call of the function in a timeslot
        if (!is_dir($ip_directory_array)) {
            symlink($ip_dir, $ip_directory_array);
        }
        if (!file_exists($base_ip_dir_array . "/" . ".profiles")) {
            // put the ip uploading ip addresses which should be segragated while massaging.
            file_put_contents("{$base_ip_dir_array}/.profiles", $ip, FILE_APPEND | LOCK_EX);
            //touch(($base_ip_dir_array."/".".profiles"));
            error_log(".profiles created" . "\n" . sprintf($server_cfg['log_file'], $game_cfg['name']));
        }
        if (!file_exists($base_ip_dir_array . "/" . ".slowpages")) {
            touch($base_ip_dir_array . "/" . ".slowpages");
            error_log(".slowpages created" . "\n" . sprintf($server_cfg['log_file'], $game_cfg['name']));
        }
        if (!file_exists($base_ip_dir_array . "/" . ".apache_stats")) {
            touch($base_ip_dir_array . "/" . ".apache_stats");
            error_log(".apache_stats created" . "\n" . sprintf($server_cfg['log_file'], $game_cfg['name']));
        }
    }
    return $return;
}
开发者ID:shourya07,项目名称:zperfmon,代码行数:49,代码来源:array_wise_split.php


示例12: __construct

 public function __construct($server_cfg, $game, $slack_now = false)
 {
     $cfg = get_eu_cfg($server_cfg['eu_conf_file']);
     $db_server = $cfg["db_host"];
     $db_user = $cfg["db_user"];
     $db_pass = $cfg["db_pass"];
     $db_name = $cfg["db_name"];
     $this->table = $cfg["table"];
     $this->game = $game;
     $this->game_cfg = load_game_config($game);
     $this->server_cfg = $server_cfg;
     parent::__construct($db_server, $db_user, $db_pass, $db_name);
     $this->max_metric = $this->get_max_metric($slack_now);
     $this->rs = new Rightscale($server_cfg, $game);
 }
开发者ID:shourya07,项目名称:zperfmon,代码行数:15,代码来源:instance-eu-adapter.php


示例13: main

function main($server_cfg)
{
    $options = get_options();
    if (isset($options['g']) && $options['g'] !== '') {
        $game_names = explode(",", $options['g']);
    } else {
        $game_names = $server_cfg['game_list'];
    }
    foreach ($game_names as $game_name) {
        zpm_preamble($game_name);
        try {
            $game_cfg = load_game_config($game_name);
            //$game_cfg = $game_cfg[$game_name];
            $now = time();
            $query_period = $now - 5 * 60;
            // 5 minutes ago
            if (isset($game_cfg['splunk_url'])) {
                $splunk_url = $game_cfg['splunk_url'];
                $splunk_user = $game_cfg['splunk_user'];
                $splunk_pass = $game_cfg['splunk_password'];
                $splunk_queries = $game_cfg['splunk_queries'];
                $splunk_collector = new SplunkCollector($splunk_url, $splunk_user, $splunk_pass);
                $splunk_store = new SplunkAdapter($game_cfg);
                foreach ($splunk_queries as $query_name => $query) {
                    $results = $splunk_collector->run_query($query, $query_period);
                    if (is_array($results)) {
                        $count = $results[0]["count"];
                        $splunk_store->store_splunk_count($now, $query_name, $count);
                    } else {
                        echo "Could not fetch {$query_name} for {$game_name}\n";
                    }
                }
            }
        } catch (Exception $e) {
        }
        zpm_postamble($game_name);
    }
}
开发者ID:shourya07,项目名称:zperfmon,代码行数:38,代码来源:get_splunk_metrics.php


示例14: main

function main($server_cfg)
{
    $options = getopt("g:");
    $game = $options['g'];
    $game_cfg = load_game_config($game);
    $hostConfigObj = new HostgroupConfig($server_cfg, $game);
    $rsObj = new RightScale($server_cfg, $game_cfg);
    $array_id_name = array_values($rsObj->get_array_to_arrayid_mapping());
    $config_col_names = $hostConfigObj->get_config_column_names();
    $xhprofModelObj = new XhprofModel($server_cfg, $game_cfg, false);
    // add columns for both the tables
    $tables = array("vertica_stats_30min", "vertica_stats_daily");
    echo "adding columns for {$game}:\n";
    foreach ($tables as $table) {
        $result = add_missing_columns($config_col_names, $table, $xhprofModelObj);
    }
    foreach ($array_id_name as $array_id) {
        echo "adding columns for {$game}:{$array_id}:\n";
        $game_cfg = load_game_config($game, $array_id);
        $xhprofModelObj = new XhprofModel($server_cfg, $game_cfg, false);
        foreach ($tables as $table) {
            $result = add_missing_columns($config_col_names, $table, $xhprofModelObj);
        }
    }
}
开发者ID:shourya07,项目名称:zperfmon,代码行数:25,代码来源:vertica_table_add_column.php


示例15: move_slow_page

function move_slow_page($server_cfg, $game_name, $time_slot = '*', &$top5)
{
    $output = array();
    $root_upload_directory = sprintf($server_cfg['root_upload_directory'], $game_name);
    //checking if the input game_name corresponds to a array of a parent game
    try {
        $game_cfg = array();
        if (!in_array($game_name, $server_cfg["game_list"])) {
            /*$game_split = split("_", $game_name);
            		$game_name_array = array();
            		for ( $counter = 0; $counter < count($game_split)-1; $counter ++) {
            			array_push($game_name_array, $game_split[$counter]);
            		}
            		$game_name = implode($game_name_array);
            		$array_id = $game_split[count($game_split)-1];*/
            $last_tok_index = strrpos($game_name, "_");
            $array_id = substr($game_name, $last_tok_index + 1, strlen($game_name) - $last_tok_index);
            $game_name = substr($game_name, 0, $last_tok_index);
            $game_cfg = load_game_config($game_name, $array_id);
        } else {
            $game_cfg = load_game_config($game_name);
        }
        $game_name = $game_cfg["name"];
        if (!$game_cfg) {
            error_log("configuration for " . $game_name . " is not loaded\n", 3, sprintf($server_cfg['log_file'], $game_cfg['name']));
            return $output;
        }
    } catch (Exception $e) {
        error_log("configuration loading for {$game_name} failed\n", 3, sprintf($server_cfg['log_file'], $game_cfg['name']));
        error_log("Exception says: " . $e->getMessage() . "\n", 3, sprintf($server_cfg['log_file'], $game_cfg['name']));
    }
    $slowpage_markers = glob("{$root_upload_directory}{$time_slot}/" . $server_cfg['profile_upload_directory'] . "/.slowpages", GLOB_BRACE);
    if (empty($slowpage_markers)) {
        error_log("No slowpage for {$time_slot}\n", 3, sprintf($server_cfg['log_file'], $game_name));
        return $output;
    }
    foreach ($slowpage_markers as $marker) {
        $profile_upload_directory = dirname($marker);
        $timestamp = (int) (basename(dirname(dirname($marker))) * 1800);
        error_log("slow pages for {$profile_upload_directory}\n", 3, sprintf($server_cfg['log_file'], $game_name));
        foreach (glob("{$profile_upload_directory}/*php") as $page_dir) {
            if (!is_dir($page_dir)) {
                continue;
            }
            scan($server_cfg, $game_name, $game_cfg["slow_page_threshold"], $page_dir, $time_slot, $output, $top5);
        }
    }
    error_log(sprintf("in move_slow_page top5 list has %d lines\n", count($top5)), 3, sprintf($server_cfg['log_file'], $game_name));
    return $output;
}
开发者ID:shourya07,项目名称:zperfmon,代码行数:50,代码来源:move_slowpages.php


示例16: main

function main($server_cfg)
{
    $options = get_options();
    if (isset($options['g']) && $options['g'] !== '') {
        $game_names = explode(",", $options['g']);
    } else {
        $game_names = $server_cfg['game_list'];
    }
    $time_slots = null;
    if (!empty($options['t'])) {
        $time_slots = $options['t'];
    }
    $timestamp = $_SERVER['REQUEST_TIME'];
    $current_time_slot = (int) ($timestamp / (30 * 60));
    foreach ($game_names as $game_name) {
        zpm_preamble($game_name);
        // MODIFIED!!!! Create and mount next two timeslots !!!
        $game_cfg = load_game_config($game_name);
        if (!$game_cfg) {
            error_log("configuration for " . $game_name . " is not loaded\n", 3, sprintf($server_cfg['log_file'], $game_cfg['name']));
            continue;
        }
        $target_dir = sprintf($server_cfg['root_upload_directory'], $game_cfg["name"]);
        $target_dir = $target_dir . "/%s/" . $server_cfg["profile_upload_directory"];
        $dir_name_array = create_directory($target_dir, $current_time_slot, $server_cfg, $game_cfg);
        if ($dir_name_array === null) {
            error_log("Directory creation failed for the game " . $game_cfg['name'], 3, sprintf($server_cfg['log_file'], $game_cfg['name']));
            continue;
        }
        if ($dir_name_array === 0) {
            error_log("No Ram disk Exist!!!" . $game_cfg['name'], 3, sprintf($server_cfg['log_file'], $game_cfg['name']));
        }
        //creating new games and getting the list of web arrays to process data for
        $rs = new RightScale($server_cfg, load_game_config($game_name));
        $rs->make_array_games();
        $array_ids = $rs->get_arrays_to_serve();
        //
        // Wrap processing for each game inside a file lock
        //
        $game_lock_file = sprintf($server_cfg["zperfmon_lock_file"], $game_name);
        $game_lock_handle = grab_lock($game_lock_file, $server_cfg, $game_cfg);
        if (!$game_lock_handle) {
            error_log("Could not get exclusive lock for \"{$game_name}\"\n", 3, sprintf($server_cfg['log_file'], $game_cfg['name']));
            delete_ramdisk_data($game_name, $time_slots, $timestamp, $server_cfg, $game_cfg);
            continue;
        }
        //processing parent game
        try {
            //
            // process uploaded data
            //
            run_cron_for_game($server_cfg, $game_cfg, $time_slots);
        } catch (Exception $e) {
            error_log("Upload processing for {$game_name} failed\n", 3, sprintf($server_cfg['log_file'], $game_cfg['name']));
            error_log("Exception says: " . $e->getMessage() . "\n", 3, sprintf($server_cfg['log_file'], $game_cfg['name']));
        }
        // loop to process data for each web array
        foreach ($array_ids as $array) {
            try {
                $game_cfg = load_game_config($game_name, $array);
                if (!$game_cfg) {
                    error_log("configuration for " . $game_name . " is not loaded\n", 3, sprintf($server_cfg['log_file'], $game_cfg['name']));
                    continue;
                }
                //
                // process uploaded data
                //
                run_cron_for_game($server_cfg, $game_cfg, $time_slots);
            } catch (Exception $e) {
                error_log("Upload processing for {$game_name} failed\n", 3, sprintf($server_cfg['log_file'], $game_cfg['name']));
                error_log("Exception says: " . $e->getMessage() . "\n", 3, sprintf($server_cfg['log_file'], $game_cfg['name']));
            }
        }
        // compress for parent game
        // This implementation forces us to always pass a timeslot
        // while calling this script. otherwise compression will fail.
        $game_cfg = load_game_config($game_name);
        compress_unziped_profiles($server_cfg, $game_cfg, $time_slots);
        // Now compress the array games
        foreach ($array_ids as $array) {
            $game_cfg = load_game_config($game_name, $array);
            compress_unziped_profiles($server_cfg, $game_cfg, $time_slots);
        }
        // cleanup the lock
        drop_lock($game_lock_handle, $game_lock_file);
        zpm_postamble($game_name);
        //MODIFIED!!!!
        if ($dir_name_array != 0) {
            delete_ramdisk_data($game_name, $time_slots, $timestamp, $server_cfg, $game_cfg);
        }
    }
}
开发者ID:shourya07,项目名称:zperfmon,代码行数:92,代码来源:get_game_metrics.php


示例17: end

        }
        $profile = end($profile_list);
    }
    /* now create an array whih contains data,
     *	 for all the pages and return an object,
     *	 having page name as key and data as their value 
     */
    $top_fn = array();
    $page_data = array();
    if ($pages != null) {
        foreach ($pages as $page) {
            $profile_list = glob("{$prof_path}/*{$page}.xhprof");
            if (empty($profile_list)) {
                //echo "no profile in $period $prof_path/*.all.xhprof";
                continue;
            }
            $profile = end($profile_list);
            $page_data[$page] = get_top_functions($profile, $metrics, $how_many);
            $top_fn = array_merge($top_fn, $page_data);
        }
        return $top_fn;
    } else {
        return get_top_functions($profile, $metrics, $how_many);
    }
}
//$test_mode = true;
if (isset($test_mode) && $test_mode) {
    $game_cfg = load_game_config("fluid");
    //$game_cfg = $game_cfg["fluid"];
    print_r(get_pie($server_cfg, $game_cfg));
}
开发者ID:shourya07,项目名称:zperfmon,代码行数:31,代码来源:profilepie.inc.php


示例18: partition_dynamics

function partition_dynamics($game_names, $server_cfg, $con, $log_file)
{
    //Month to Partition map
    $partition_drop_map = array('p001', 'p002', 'p003', 'p004', 'p005', 'p006', 'p001', 'p002', 'p003', 'p004', 'p005', 'p006');
    //Current month to retention month p_tag map.
    $cursor_retain_months = array(11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
    $month_index = date('m') - 1;
    $array_drop_index = $month_index - 2;
    //If array drop index is negative go to the end of array
    if ($array_drop_index < 0) {
        $array_drop_index = 12 + $array_drop_index;
    }
    $partition_drop_array_games = $partition_drop_map[$array_drop_index];
    foreach ($game_names as $game) {
        $db = "zprf_" . $game;
        report_partitions_state($db, $con, $log_file);
        $cursor_retain = $cursor_retain_months[$month_index];
        $cursor_delete = 0 - $cursor_retain;
        //Deleting rows in the ratio 1:4
        delete_rows($cursor_delete, $db, $con, $log_file);
        //Doing an alter table
        crunch_space($db, $con, $log_file);
        //Fetching the retention time from game_cfg file
        $game_cfg = load_game_config($game);
        $retention_time = $game_cfg["xhprof_retention_time"];
        //Maximum retention time = 4 months
        //If retention time not specified setting the default retention time as 4 months
        if ($retention_time == NULL or $retention_time > 4) {
            $retention_time = 4;
        }
        $partition_drop_index = $month_index - $retention_time - 1;
        if ($partition_drop_index < 0) {
            $partition_drop_index = 12 + $partition_drop_index;
        }
        $partition_drop = $partition_drop_map[$partition_drop_index];
        $rs = new RightScale($server_cfg, load_game_config($game));
        $array_ids = $rs->get_arrays_to_serve();
        drop_partition_data($partition_drop, $partition_drop_array_games, $array_ids, $db, $con, $log_file);
    }
}
开发者ID:shourya07,项目名称:zperfmon,代码行数:40,代码来源:zperfmon_partition_dynamics.php


示例19: getopt

                break;
            case 'POST':
                $game = $_POST["game"];
                $arrayid = @$_POST["array"];
                break;
            default:
                $game = null;
                $arrayid = null;
                break;
        }
    } else {
        $options = getopt("g:");
        if (isset($options["g"])) {
            $game = $options["g"];
        }
    }
} catch (Exception $e) {
    $game = null;
}
if (!isset($game) || !$game) {
    echo "<body>Error: expected a game name parameter, eg.: <b>\"?game=fish\"</b></body></html>";
    exit(1);
}
if (isset($arrayid) && $arrayid == "all") {
    $arrayid = null;
}
$game_cfg = load_game_config($game, $arrayid);
if (!$game_cfg) {
    echo "<body>Error: invalid game name: <b>\"{$game}\"</b></body></html>";
    exit(1);
}
开发者ID:shourya07,项目名称:zperfmon,代码行数:31,代码来源:setup_page.php


示例20: insert_event

function insert_event($xhProfModelObject, $server_cfg = null, $game_cfg = null, $timestamp, $type, $text)
{
    if (!$xhProfModelObject) {
        return false;
    }
    $query_name = "event_insert";
    $result = null;
    $result = $xhProfModelObject->generic_execute_get_query($query_name, array('start' => $timestamp, 'type' => $type, 'text' => $text), false, false);
    //if its a array, just return, else if its a game ,fill the array dbs as well
    if (isset($game_cfg['parent'])) {
        //its an array, so our work here is done, return
        return $result;
    }
    $result_array = null;
    $arrays = get_array_id_map($server_cfg, $game_cfg);
    //for loop to put events in each array db
    foreach ($arrays as $array => $array_id) {
        $game_array_cfg = load_game_config($game_cfg['name'], $array_id);
        $xhProfModelObject = new XhProfModel($server_cfg, $game_array_cfg, false);
        $result_array = $xhProfModelObject->generic_execute_get_query($query_name, array('start' => $timestamp, 'type' => $type, 'text' => $text), false, false);
    }
    return $result;
}
开发者ID:shourya07,项目名称:zperfmon,代码行数:23,代码来源:uploader.php



注:本文中的load_game_config函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP load_global_settings函数代码示例发布时间:2022-05-15
下一篇:
PHP load_fwobject函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap