#! /usr/bin/env php . // size_census [--all_apps] // for each multi-size app, // find the N quantiles of its effective speed, // and write them to a file. // See http://boinc.berkeley.edu/trac/wiki/JobSizeMatching // // --all_apps: compute quantiles for all apps; // use this during setup and testing. error_reporting(E_ALL); ini_set('display_errors', true); ini_set('display_startup_errors', true); require_once("../inc/boinc_db.inc"); function do_app($app) { // enumerate the host_app_versions for this app, // joined to the host $db = BoincDb::get(); $query = "select et_avg, host.on_frac, host.active_frac, host.gpu_active_frac, app_version.plan_class " . " from DBNAME.host_app_version, DBNAME.host, DBNAME.app_version " . " where host_app_version.app_version_id = app_version.id " . " and app_version.appid = $app->id " . " and et_n > 0 " . " and host.id = host_app_version.host_id"; $result = $db->do_query($query); $a = array(); while ($x = _mysql_fetch_object($result)) { if (is_gpu($x->plan_class)) { $av = $x->on_frac; if ($x->gpu_active_frac) { $av *= $x->gpu_active_frac; } else { $av *= $x->active_frac; } } else { $av = $x->on_frac * $x->active_frac; } $a[] = (1/$x->et_avg) * $av; } _mysql_free_result($result); sort($a); $n = count($a); $f = fopen("../../size_census_".$app->name, "w"); for ($i=1; $i<$app->n_size_classes; $i++) { $k = (int)(($i*$n)/$app->n_size_classes); fprintf($f, "%e\n", $a[$k]); } fclose($f); } if ($argc == 2 && $argv[1]=="--all_apps") { $apps = BoincApp::enum("deprecated=0"); } else { $apps = BoincApp::enum("deprecated=0 and n_size_classes>1"); } foreach ($apps as $app) { do_app($app); } ?>