Example #1
0
function main($argc, $argv)
{
    /****************************
     * Model specific variables *
     ****************************/
    $noNodes = 0;
    $noStreams = 0;
    $solve_as = APPROX;
    // or EXACT;
    $pop = 3.0;
    $think = 0.1;
    /************************
     * Initialize the model *
     ************************/
    /* Give model a name and initialize internal PDQ variables */
    PDQ_Init("Closed Queue");
    printf("**** %s ****:\n", $solve_as == EXACT ? "EXACT" : "APPROX");
    /* Define the workload and circuit type */
    $noStreams = PDQ_CreateClosed("w1", TERM, 1.0 * $pop, $think);
    /* Define the queueing center */
    $noNodes = PDQ_CreateNode("node", CEN, FCFS);
    /* Define service demand */
    PDQ_SetDemand("node", "w1", 0.1);
    /*******************
     * Solve the model *
     *******************/
    PDQ_Solve($solve_as);
    PDQ_Report();
}
Example #2
0
function main()
{
    global $nodes, $streams;
    // this are global to PDQ_Lib
    $k = 0;
    // Warning!! k is a global name in the PDQ_Lib!!!!
    $name = "";
    $nstr = "";
    /* input parameters */
    $think = 10.0;
    $users = 300;
    // 800;
    $Sifp = 0.1;
    $Samp = 0.6;
    $Sdsu = 1.2;
    $Nifp = 15;
    $Namp = 50;
    $Ndsu = 100;
    // PDQ_SetDebug(TRUE);
    PDQ_Init("Teradata DBC-10/12");
    /* Create parallel centers */
    for ($k = 0; $k < $Nifp; $k++) {
        itoa($k, $nstr);
        $name = "IFP" . $nstr;
        $nodes = PDQ_CreateNode($name, CEN, FCFS);
    }
    for ($k = 0; $k < $Namp; $k++) {
        itoa($k, $nstr);
        $name = "AMP" . $nstr;
        $nodes = PDQ_CreateNode($name, CEN, FCFS);
    }
    for ($k = 0; $k < $Ndsu; $k++) {
        itoa($k, $nstr);
        $name = "DSU" . $nstr;
        $nodes = PDQ_CreateNode($name, CEN, FCFS);
    }
    $streams = PDQ_CreateClosed("query", TERM, (double) $users, $think);
    /*PDQ_SetGraph("query", 100); - unsupported call */
    for ($k = 0; $k < $Nifp; $k++) {
        itoa($k, $nstr);
        $name = "IFP" . $nstr;
        PDQ_SetDemand($name, "query", $Sifp / $Nifp);
    }
    for ($k = 0; $k < $Namp; $k++) {
        itoa($k, $nstr);
        $name = "AMP" . $nstr;
        PDQ_SetDemand($name, "query", $Samp / $Namp);
    }
    for ($k = 0; $k < $Ndsu; $k++) {
        itoa($k, $nstr);
        $name = "DSU" . $nstr;
        PDQ_SetDemand($name, "query", $Sdsu / $Ndsu);
    }
    /* 300 nodes takes about a minute to solve on a PowerMac */
    printf("Solving ... ");
    PDQ_Solve(APPROX);
    printf("Done.\n");
    /* PDQ_PrintXLS(); */
    PDQ_Report();
}
Example #3
0
function mem_model($n, $m)
{
    $x = 0.0;
    $i = 0;
    $noNodes = 0;
    $noStreams = 0;
    global $sm_x;
    for ($i = 1; $i <= $n; $i++) {
        if ($i <= $m) {
            PDQ_Init("");
            $noNodes = PDQ_CreateNode("CPU", CEN, FCFS);
            $noNodes = PDQ_CreateNode("DK1", CEN, FCFS);
            $noNodes = PDQ_CreateNode("DK2", CEN, FCFS);
            $noStreams = PDQ_CreateClosed("work", TERM, (double) $i, 0.0);
            PDQ_SetDemand("CPU", "work", 3.0);
            PDQ_SetDemand("DK1", "work", 4.0);
            PDQ_SetDemand("DK2", "work", 2.0);
            PDQ_Solve(EXACT);
            $x = PDQ_GetThruput(TERM, "work");
            $sm_x[$i] = $x;
        } else {
            $sm_x[$i] = $x;
            /* last computed value */
        }
    }
}
Example #4
0
function main()
{
    /****************************
     * Model specific variables *
     ****************************/
    $noNodes = 0;
    $noStreams = 0;
    $tech = APPROX;
    // EXACT
    $pop = 0;
    $think = 0.0;
    /************************
     * Initialize the model *
     ************************/
    /* Give model a name */
    printf("**** %s ****:\n", $tech == EXACT ? "EXACT" : "APPROX");
    printf("%s\t\t%s\t\t%s\t\t%s\t\t%s\n", "POP", "N:w1", "RESP:w1", "N:w2", "RESP:w2");
    printf("-----------------------------------------------------------------------------\n");
    for ($pop = 1; $pop < 10; $pop++) {
        PDQ_Init("Test_Exact_calc");
        /* Define the workload and circuit type */
        $noStreams = PDQ_CreateClosed("w1", TERM, 1.0 * $pop, $think);
        $noStreams = PDQ_CreateClosed("w2", TERM, 1.0 * $pop, $think);
        /* Define the queueing center */
        $noNodes = PDQ_CreateNode("node", CEN, FCFS);
        /* Define service demand */
        PDQ_SetDemand("node", "w1", 1.0);
        PDQ_SetDemand("node", "w2", 0.5);
        /*******************
         * Solve the model *
         *******************/
        PDQ_Solve($tech);
        printf("%d\t\t%d\t\t%3.4f\t\t%d\t\t%3.4f\n", $pop, getjob_pop(getjob_index("w1")), PDQ_GetResponse(TERM, "w1"), getjob_pop(getjob_index("w1")), PDQ_GetResponse(TERM, "w2"));
    }
}
Example #5
0
function main()
{
    $noNodes = 0;
    $noStreams = 0;
    // the following is defined in the original C version but never used.
    $arrivals = 16.0 / 3600;
    /* 16 applications per hour */
    /* Branching probabilities and weights */
    $p12 = 0.3;
    $p13 = 0.7;
    $p23 = 0.2;
    $p32 = 0.1;
    $w3 = ($p13 + $p23 * $p12) / (1 - $p23 * $p32);
    $w2 = $p12 + $p32 * $w3;
    /* Initialize and solve the model */
    PDQ_Init("Passport Office");
    $noStreams = PDQ_CreateOpen("Applicant", 0.00427);
    $noNodes = PDQ_CreateNode("Window1", CEN, FCFS);
    $noNodes = PDQ_CreateNode("Window2", CEN, FCFS);
    $noNodes = PDQ_CreateNode("Window3", CEN, FCFS);
    $noNodes = PDQ_CreateNode("Window4", CEN, FCFS);
    PDQ_SetDemand("Window1", "Applicant", 20.0);
    PDQ_SetDemand("Window2", "Applicant", 600.0 * $w2);
    PDQ_SetDemand("Window3", "Applicant", 300.0 * $w3);
    PDQ_SetDemand("Window4", "Applicant", 60.0);
    PDQ_Solve(CANON);
    PDQ_Report();
}
Example #6
0
function main()
{
    $noNodes = 0;
    $noStreams = 0;
    $arrivals_per_second = 0.1;
    /* Initialize and solve the model */
    PDQ_Init("Simple Series Circuit");
    $noStreams = PDQ_CreateOpen("Work", $arrivals_per_second);
    $noNodes = PDQ_CreateNode("Center1", CEN, FCFS);
    $noNodes = PDQ_CreateNode("Center2", CEN, FCFS);
    $noNodes = PDQ_CreateNode("Center3", CEN, FCFS);
    PDQ_SetDemand("Center1", "Work", 1.0);
    PDQ_SetDemand("Center2", "Work", 2.0);
    PDQ_SetDemand("Center3", "Work", 3.0);
    PDQ_Solve(CANON);
    PDQ_Report();
}
Example #7
0
function main()
{
    global $job;
    /****************************
     * Model specific variables *
     ****************************/
    $noNodes = 0;
    $noStreams = 0;
    $pop = 0;
    $servers = 2;
    $s = 0;
    $w = HOMEPG;
    $work = array(0 => "stress", 1 => "homepg");
    /* stress */
    /* homepg */
    $time = array(0 => 0.0044, 1 => 0.03);
    $slave = array(0 => "slave0", "slave1", "slave2", "slave3", "slave4", "slave5", "slave6", "slave7", "slave8", "slave9", "slave10", "slave11", "slave12", "slave13", "slave14", "slave15");
    if (PREFORK) {
        printf("Pre-Fork Model under \"%s\" Load (m = %d)\n", $w == STRESS ? $work[STRESS] : $work[HOMEPG], $servers);
    } else {
        printf("Forking  Model under \"%s\" Load \n", $w == STRESS ? $work[STRESS] : $work[HOMEPG]);
    }
    printf("N\tX\tR\n");
    for ($pop = 1; $pop <= 10; $pop++) {
        PDQ_Init("HTTPd_Server");
        $noStreams = PDQ_CreateClosed($work[$w], TERM, 1.0 * $pop, 0.0);
        $noNodes = PDQ_CreateNode("master", CEN, FCFS);
        if (PREFORK) {
            for ($s = 0; $s < $servers; $s++) {
                $noNodes = PDQ_CreateNode($slave[$s], CEN, FCFS);
            }
            PDQ_SetDemand("master", $work[$w], 0.0109);
            for ($s = 0; $s < $servers; $s++) {
                PDQ_SetDemand($slave[$s], $work[$w], $time[$w] / $servers);
            }
        } else {
            /* FORKING */
            $noNodes = PDQ_CreateNode("forks", CEN, ISRV);
            PDQ_SetDemand("master", $work[$w], 0.0165);
            PDQ_SetDemand("forks", $work[$w], $time[$w]);
        }
        PDQ_Solve(EXACT);
        printf("%3.2f\t%3.4f\t%3.4f\n", getjob_pop(getjob_index($work[$w])), PDQ_GetThruput(TERM, $work[$w]), PDQ_GetResponse(TERM, $work[$w]));
    }
}
Example #8
0
function main($argc, $argv)
{
    //----- Model specific variables ---------------------------------------
    global $streams, $nodes;
    $pop = 100.0;
    $think = 300.0;
    $servt = 0.63;
    //----- Initialize the model -------------------------------------------
    /* Give model a name */
    PDQ_Init("Time Share Computer");
    /* Define the workload and circuit type */
    $streams = PDQ_CreateClosed("compile", TERM, $pop, $think);
    /* Define the queueing center */
    $nodes = PDQ_CreateNode("CPU", CEN, FCFS);
    /* Define service demand */
    PDQ_SetDemand("CPU", "compile", $servt);
    //----- Solve the model ------------------------------------------------
    PDQ_Solve(EXACT);
    //----- Solve the model ------------------------------------------------
    PDQ_Report();
}
Example #9
0
function main($argc, $argv)
{
    global $nodes, $streams;
    //---- Model specific variables -----
    $rx_prob = 0.3;
    $inter_arriv_rate = 0.5;
    $service_time = 0.75;
    $mean_visits = 1.0 / (1.0 - $rx_prob);
    //----- Initialize the model -----
    // Give model a name */
    PDQ_Init("Open Feedback");
    // Define the queueing center
    $nodes = PDQ_CreateNode("channel", CEN, FCFS);
    // Define the workload and circuit type
    $streams = PDQ_CreateOpen("message", $inter_arriv_rate);
    // Define service demand due to workload on the queueing center
    PDQ_SetVisits("channel", "message", $mean_visits, $service_time);
    //----- Solve the model -----
    // Must use the CANONical method for an open circuit
    PDQ_Solve(CANON);
    // Generate a report
    PDQ_Report();
}
Example #10
0
function main($argc, $argv)
{
    //----- Model specific variables -----
    global $nodes, $streams;
    $arrivRate = 0.75;
    $service_time = 1.0;
    //----- Initialize the model & Give it a name ------
    PDQ_Init("OpenCenter");
    //----- Change unit labels -----
    PDQ_SetWUnit("Customers");
    PDQ_SetTUnit("Seconds");
    //----- Define the queueing center -----
    $nodes = PDQ_CreateNode("server", CEN, FCFS);
    //----- Define the workload and circuit type -----
    $streams = PDQ_CreateOpen("work", $arrivRate);
    //----- Define service demand due to workload on the queueing center ------
    PDQ_SetDemand("server", "work", $service_time);
    //----- Solve the model -----
    //  Must use the CANONical method for an open circuit
    PDQ_Solve(CANON);
    //----- Generate a report -----
    PDQ_Report();
}
Example #11
0
function multiserver($m, $stime)
{
    global $sm_x;
    $i = 0;
    $nodes = 0;
    $streams = 0;
    $x = 0.0;
    $work = "reqs";
    $node = "bus";
    for ($i = 1; $i <= CPUS; $i++) {
        if ($i <= $m) {
            PDQ_Init("multibus");
            $streams = PDQ_CreateClosed($work, TERM, (double) $i, 0.0);
            $nodes = PDQ_CreateNode($node, CEN, ISRV);
            PDQ_SetDemand($node, $work, $stime);
            PDQ_Solve(EXACT);
            $x = PDQ_GetThruput(TERM, $work);
            $sm_x[$i] = $x;
        } else {
            $sm_x[$i] = $x;
        }
    }
}
Example #12
0
function main()
{
    /************************
     * PDQ global variables *
     ************************/
    $noNodes = 0;
    $noStreams = 0;
    /************************
     * Initialize the model *
     ************************/
    /* Give model a name */
    PDQ_Init("Multiclass Test");
    /* Define the workload and circuit type */
    $noStreams = PDQ_CreateClosed("term1", TERM, 5.0, 20.0);
    $noStreams = PDQ_CreateClosed("term2", TERM, 15.0, 30.0);
    $noStreams = PDQ_CreateClosed("batch", BATCH, 5.0, 0.0);
    /* Define the queueing center */
    $noNodes = PDQ_CreateNode("node1", CEN, FCFS);
    $noNodes = PDQ_CreateNode("node2", CEN, FCFS);
    $noNodes = PDQ_CreateNode("node3", CEN, FCFS);
    /* Define service demand */
    PDQ_SetDemand("node1", "term1", 0.5);
    PDQ_SetDemand("node1", "term2", 0.04);
    PDQ_SetDemand("node1", "batch", 0.06);
    PDQ_SetDemand("node2", "term1", 0.4);
    PDQ_SetDemand("node2", "term2", 0.2);
    PDQ_SetDemand("node2", "batch", 0.3);
    PDQ_SetDemand("node3", "term1", 1.2);
    PDQ_SetDemand("node3", "term2", 0.05);
    PDQ_SetDemand("node3", "batch", 0.06);
    /*******************
     * Solve the model *
     *******************/
    PDQ_Solve(EXACT);
    PDQ_Report();
}
Example #13
0
function main()
{
    $noNodes = 0;
    $noStreams = 0;
    $noPri = "CPU Scheduler - No Pri";
    $priOn = "CPU Scheduler - Pri On";
    $Ucpu_prod = 0.0;
    if (PRIORITY) {
        $Ucpu_prod = GetProdU();
    }
    PDQ_Init(PRIORITY ? $priOn : $noPri);
    // workloads ...
    $noStreams = PDQ_CreateClosed("Production", TERM, 20.0, 20.0);
    $noStreams = PDQ_CreateClosed("Developmnt", TERM, 15.0, 15.0);
    // queueing noNodes ...
    $noNodes = PDQ_CreateNode("CPU", CEN, FCFS);
    if (PRIORITY) {
        $noNodes = PDQ_CreateNode("shadCPU", CEN, FCFS);
    }
    $noNodes = PDQ_CreateNode("DK1", CEN, FCFS);
    $noNodes = PDQ_CreateNode("DK2", CEN, FCFS);
    // service demands at each node ...
    PDQ_SetDemand("CPU", "Production", 0.3);
    if (PRIORITY) {
        PDQ_SetDemand("shadCPU", "Developmnt", 1.0 / (1 - $Ucpu_prod));
    } else {
        PDQ_SetDemand("CPU", "Developmnt", 1.0);
    }
    PDQ_SetDemand("DK1", "Production", 0.08);
    PDQ_SetDemand("DK1", "Developmnt", 0.05);
    PDQ_SetDemand("DK2", "Production", 0.1);
    PDQ_SetDemand("DK2", "Developmnt", 0.06);
    // We use APPROX rather than EXACT to match the numbers in the book
    PDQ_Solve(APPROX);
    PDQ_Report();
}
Example #14
0
function main()
{
    global $job;
    $model = "Middleware I";
    $work = "eBiz-tx";
    $node1 = "WebServer";
    $node2 = "AppServer";
    $node3 = "DBMServer";
    $think = 0.0 * 0.001;
    // treated as free param
    // Added dummy servers for calibration
    $node4 = "DummySvr";
    // User loads employed in WAS tool ...
    $noNodes = 0;
    $noStreams = 0;
    $users = 0;
    $u1pdq = array();
    // double [MAXUSERS+1];
    $u2pdq = array();
    // double [MAXUSERS+1];
    $u3pdq = array();
    // double [MAXUSERS+1];
    $u1err = array();
    // double [MAXUSERS+1];
    $u2err = array();
    // double [MAXUSERS+1];
    $u3err = array();
    // double [MAXUSERS+1];
    // Utilization data from the paper ...
    // In this example the following vectros contain zero value, so on line 106/107/108 can cause division by zero error!!
    $u1dat = array(0.0, 21.0, 41.0, 0.0, 74.0, 0.0, 0.0, 95.0, 0.0, 0.0, 96.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 96.0);
    // double [MAXUSERS+1]
    $u2dat = array(0.0, 8.0, 13.0, 0.0, 20.0, 0.0, 0.0, 23.0, 0.0, 0.0, 22.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 22.0);
    // double [MAXUSERS+1]
    $u3dat = array(0.0, 4.0, 5.0, 0.0, 5.0, 0.0, 0.0, 5.0, 0.0, 0.0, 6.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 6.0);
    // double [MAXUSERS+1]
    // Output header ...
    printf("\n");
    printf("(Tx: \"%s\" for \"%s\")\n\n", $work, $model);
    printf("Client delay Z=%5.2f mSec. (Assumed)\n\n", $think * 1000.0);
    printf("%3s\t%6s  %6s   %6s  %6s  %6s\n", " N ", "  X  ", "  R  ", "%Uws", "%Uas", "%Udb");
    printf("%3s\t%6s  %6s   %6s  %6s  %6s\n", "---", "------", "------", "------", "------", "------");
    for ($users = 1; $users <= MAXUSERS; $users++) {
        PDQ_Init($model);
        $noStreams = PDQ_CreateClosed($work, TERM, (double) $users, $think);
        $noNodes = PDQ_CreateNode($node1, CEN, FCFS);
        $noNodes = PDQ_CreateNode($node2, CEN, FCFS);
        $noNodes = PDQ_CreateNode($node3, CEN, FCFS);
        $noNodes = PDQ_CreateNode($node4, CEN, FCFS);
        //$noNodes = PDQ_CreateNode($node5, CEN, FCFS);
        //$noNodes = PDQ_CreateNode($node6, CEN, FCFS);
        // NOTE: timebase is seconds
        PDQ_SetDemand($node1, $work, 9.800000000000001 * 0.001);
        PDQ_SetDemand($node2, $work, 2.5 * 0.001);
        PDQ_SetDemand($node3, $work, 0.72 * 0.001);
        // dummy (network) nodes ...
        PDQ_SetDemand($node4, $work, 9.800000000000001 * 0.001);
        PDQ_Solve(EXACT);
        // set up for error analysis of utilzations
        $u1pdq[$users] = PDQ_GetUtilization($node1, $work, TERM) * 100;
        $u2pdq[$users] = PDQ_GetUtilization($node2, $work, TERM) * 100;
        $u3pdq[$users] = PDQ_GetUtilization($node3, $work, TERM) * 100;
        $u1err[$users] = 100 * ($u1pdq[$users] - $u1dat[$users]) / $u1dat[$users];
        // cause division by zero error due to u1dat vector initialization
        $u2err[$users] = 100 * ($u2pdq[$users] - $u2dat[$users]) / $u2dat[$users];
        // cause division by zero error due to u2dat vector initialization
        $u3err[$users] = 100 * ($u3pdq[$users] - $u3dat[$users]) / $u3dat[$users];
        // cause division by zero error due to u3dat vector initialization
        printf("%3d\t%6.2f  %6.2f   %6.2f  %6.2f  %6.2f\n", $users, PDQ_GetThruput(TERM, $work), PDQ_GetResponse(TERM, $work) * 1000.0, $u1pdq[$users], $u2pdq[$users], $u3pdq[$users]);
    }
    // for user
    printf("\nError Analysis of Utilizations\n\n");
    printf("%3s\t%12s  %12s  %12s\n", "   ", "          WS          ", "          AS          ", "          DB          ");
    printf("%3s\t%12s  %12s  %12s\n", "   ", "----------------------", "----------------------", "----------------------");
    printf("%3s    ", " N ");
    printf("%6s  %6s  %6s  ", "%Udat", "%Updq", "%Uerr");
    printf("%6s  %6s  %6s  ", "%Udat", "%Updq", "%Uerr");
    printf("%6s  %6s  %6s\n", "%Udat", "%Updq", "%Uerr");
    printf("%3s    ", "---");
    printf("%6s  %6s  %6s  ", "-----", "-----", "-----");
    printf("%6s  %6s  %6s  ", "-----", "-----", "-----");
    printf("%6s  %6s  %6s\n", "-----", "-----", "-----");
    for ($users = 1; $users <= MAXUSERS; $users++) {
        switch ($users) {
            case 1:
            case 2:
            case 4:
            case 7:
            case 10:
            case 20:
                printf("%3d\t%5.2f\t%5.2f\t%5.2f", $users, $u1dat[$users], $u1pdq[$users], $u1err[$users]);
                printf("\t%5.2f\t%5.2f\t%5.2f", $u2dat[$users], $u2pdq[$users], $u2err[$users]);
                printf("\t%5.2f\t%5.2f\t%5.2f\n", $u3dat[$users], $u3pdq[$users], $u3err[$users]);
                break;
            default:
                break;
        }
    }
    printf("\n");
    // Uncomment the following line for a standard PDQ summary.
    PDQ_Report();
}
Example #15
0
function main()
{
    // Name of this model ...
    $scenario = "C/S Upgrade2";
    global $job, $node;
    $noNodes = 0;
    $noStreams = 0;
    $txCD = "";
    $txRQ = "";
    $txSU = "";
    $dumCD = "";
    $dumRQ = "";
    $dumSU = "";
    $X = 0.0;
    $ulan = 0.0;
    $ufs = 0.0;
    $ugw = 0.0;
    $umf = 0.0;
    $work = 0;
    $dev = 0;
    $i = 0;
    $j = 0;
    $demand = array(array());
    // double [MAXPROC][MAXDEV]
    $util = array();
    // double [MAXDEV]
    $udsk = array();
    // double [MAXDEV]
    $upc = array();
    // double [MAXDEV]
    $udasd = array();
    // double [MAXDEV];
    for ($i = 0; $i < MAXDEV; $i++) {
        $util[$i] = 0.0;
        $udsk[$i] = 0.0;
        $upc[$i] = 0.0;
        $udasd[$i] = 0.0;
        for ($j = 0; $j < MAXPROC; $j++) {
            $demand[$j][$i] = 0.0;
        }
    }
    $PCarray = array();
    $FDarray = array();
    $MDarray = array();
    // Allocate PCarray
    for ($i = 0; $i < 2; $i++) {
        $PCarray[$i] = new DEVARRAY_TYPE();
    }
    // Allocate FDarray and MDarray
    for ($i = 0; $i < 10; $i++) {
        $FDarray[$i] = new DEVARRAY_TYPE();
        $MDarray[$i] = new DEVARRAY_TYPE();
    }
    $PCarray[0]->id = 0;
    $PCarray[0]->label = "PCreal";
    $PCarray[1]->id = 50;
    $PCarray[1]->label = "PCagg";
    for ($i = 0; $i < FS_DISKS; $i++) {
        $FDarray[$i]->id = FDA + $i;
        $FDarray[$i]->label = sprintf("FD%d", $i);
    }
    for ($i = 0; $i < MF_DISKS; $i++) {
        $MDarray[$i]->id = MDA + $i;
        $MDarray[$i]->label = sprintf("MD%d", $i);
    }
    /*
     * CPU service times are calculated from MIPS Instruction counts in
     * tables presented in original 1993 CMG paper.
     */
    $demand[CD_REQ][PC] = 200 * K / PC_MIPS;
    $demand[CD_RPY][PC] = 100 * K / PC_MIPS;
    $demand[RQ_REQ][PC] = 150 * K / PC_MIPS;
    $demand[RQ_RPY][PC] = 200 * K / PC_MIPS;
    $demand[SU_REQ][PC] = 300 * K / PC_MIPS;
    $demand[SU_RPY][PC] = 300 * K / PC_MIPS;
    $demand[REQ_CD][FS] = 50 * K / FS_MIPS;
    $demand[REQ_RQ][FS] = 70 * K / FS_MIPS;
    $demand[REQ_SU][FS] = 10 * K / FS_MIPS;
    $demand[CD_MSG][FS] = 35 * K / FS_MIPS;
    $demand[RQ_MSG][FS] = 35 * K / FS_MIPS;
    $demand[SU_MSG][FS] = 35 * K / FS_MIPS;
    $demand[GT_SND][GW] = 50 * K / GW_MIPS;
    $demand[GT_RCV][GW] = 50 * K / GW_MIPS;
    $demand[MF_CD][MF] = 50 * K / MF_MIPS;
    $demand[MF_RQ][MF] = 150 * K / MF_MIPS;
    $demand[MF_SU][MF] = 20 * K / MF_MIPS;
    // packets generated at each of the following sources ...
    $demand[LAN_TX][PC] = 2 * K * TR_FACT / TR_MBPS;
    $demand[LAN_TX][FS] = 2 * K * TR_FACT / TR_MBPS;
    $demand[LAN_TX][GW] = 2 * K * TR_FACT / TR_MBPS;
    /* File server Disk I/Os = #accesses x caching / (max IOs/Sec) */
    for ($i = 0; $i < FS_DISKS; $i++) {
        $demand[REQ_CD][$FDarray[$i]->id] = 1.0 * 0.5 / 128.9 / FS_DISKS;
        $demand[REQ_RQ][$FDarray[$i]->id] = 1.5 * 0.5 / 128.9 / FS_DISKS;
        $demand[REQ_SU][$FDarray[$i]->id] = 0.2 * 0.5 / 128.9 / FS_DISKS;
        $demand[CD_MSG][$FDarray[$i]->id] = 1.0 * 0.5 / 128.9 / FS_DISKS;
        $demand[RQ_MSG][$FDarray[$i]->id] = 1.5 * 0.5 / 128.9 / FS_DISKS;
        $demand[SU_MSG][$FDarray[$i]->id] = 0.5 * 0.5 / 128.9 / FS_DISKS;
    }
    /* Mainframe DASD I/Os = (#accesses / (max IOs/Sec)) / #disks */
    for ($i = 0; $i < MF_DISKS; $i++) {
        $demand[MF_CD][$MDarray[$i]->id] = 2.0 / 60.24 / MF_DISKS;
        $demand[MF_RQ][$MDarray[$i]->id] = 4.0 / 60.24 / MF_DISKS;
        $demand[MF_SU][$MDarray[$i]->id] = 1.0 / 60.24 / MF_DISKS;
    }
    // Start building the PDQ model  ...
    PDQ_Init($scenario);
    // Define physical resources as queues ...
    $noNodes = PDQ_CreateNode($PCarray[0]->label, CEN, FCFS);
    //$noNodes = PDQ_CreateNode(PCarray[1]->label, CEN, FCFS);
    $noNodes = PDQ_CreateNode("FS", CEN, FCFS);
    $noNodes = PDQ_CreateNode("GW", CEN, FCFS);
    $noNodes = PDQ_CreateNode("MF", CEN, FCFS);
    for ($i = 0; $i < FS_DISKS; $i++) {
        $noNodes = PDQ_CreateNode($FDarray[$i]->label, CEN, FCFS);
    }
    for ($i = 0; $i < MF_DISKS; $i++) {
        $noNodes = PDQ_CreateNode($MDarray[$i]->label, CEN, FCFS);
    }
    $noNodes = PDQ_CreateNode("TR", CEN, FCFS);
    /*
     * NOTE: Althought the Token Ring LAN is a passive device,
     * it is treated as a separate node in order to agree to the results
     * presented in the original CMG'93 paper.
     */
    if ($noNodes > MAXDEV) {
        printf("Number of noNodes %d exceeds MAXDEV = %d", $noNodes, MAXDEV);
    }
    // Assign transaction names ...
    $txCD = "CatDsply";
    $txRQ = "RemQuote";
    $txSU = "StatusUp";
    $dumCD = "CDdummy ";
    $dumRQ = "RQdummy ";
    $dumSU = "SUdummy ";
    // Define an OPEN circuit workloads ...
    $noStreams = PDQ_CreateOpen($txCD, 4.0 / 60.0);
    $noStreams = PDQ_CreateOpen($txRQ, 8.0 / 60.0);
    $noStreams = PDQ_CreateOpen($txSU, 1.0 / 60.0);
    $noStreams = PDQ_CreateOpen($dumCD, (USERS - 1) * 4.0 / 60.0);
    $noStreams = PDQ_CreateOpen($dumRQ, (USERS - 1) * 8.0 / 60.0);
    $noStreams = PDQ_CreateOpen($dumSU, (USERS - 1) * 1.0 / 60.0);
    // Define the service demands on each physical resource
    // CD request + reply chain  from workflow diagram
    PDQ_SetDemand($PCarray[0]->label, $txCD, $demand[CD_REQ][PC] + 5 * $demand[CD_RPY][PC]);
    // PDQ_SetDemand($PCarray[1]->label, $dumCD,($demand[CD_REQ][PC] + (5 * $demand[CD_RPY][PC])) / (USERS - 1));
    PDQ_SetDemand("FS", $txCD, $demand[REQ_CD][FS] + 5 * $demand[CD_MSG][FS]);
    PDQ_SetDemand("FS", $dumCD, $demand[REQ_CD][FS] + 5 * $demand[CD_MSG][FS]);
    for ($i = 0; $i < FS_DISKS; $i++) {
        PDQ_SetDemand($FDarray[$i]->label, $txCD, $demand[REQ_CD][$FDarray[$i]->id] + 5 * $demand[CD_MSG][$FDarray[$i]->id]);
        PDQ_SetDemand($FDarray[$i]->label, $dumCD, $demand[REQ_CD][$FDarray[$i]->id] + 5 * $demand[CD_MSG][$FDarray[$i]->id]);
    }
    PDQ_SetDemand("GW", $txCD, $demand[GT_SND][GW] + 5 * $demand[GT_RCV][GW]);
    PDQ_SetDemand("GW", $dumCD, $demand[GT_SND][GW] + 5 * $demand[GT_RCV][GW]);
    PDQ_SetDemand("MF", $txCD, $demand[MF_CD][MF]);
    PDQ_SetDemand("MF", $dumCD, $demand[MF_CD][MF]);
    for ($i = 0; $i < MF_DISKS; $i++) {
        PDQ_SetDemand($MDarray[$i]->label, $txCD, $demand[MF_CD][$MDarray[$i]->id]);
        PDQ_SetDemand($MDarray[$i]->label, $dumCD, $demand[MF_CD][$MDarray[$i]->id]);
    }
    /*
     * NOTE: Synchronous process execution causes data related to the the CD
     * transaction to cross the LAN 12 times as depicted in the following
     * parameterization of PDQ_SetDemand.
     */
    PDQ_SetDemand("TR", $txCD, 1 * $demand[LAN_TX][PC] + 1 * $demand[LAN_TX][FS] + 5 * $demand[LAN_TX][GW] + 5 * $demand[LAN_TX][FS]);
    PDQ_SetDemand("TR", $dumCD, 1 * $demand[LAN_TX][PC] + 1 * $demand[LAN_TX][FS] + 5 * $demand[LAN_TX][GW] + 5 * $demand[LAN_TX][FS]);
    // RQ request + reply chain ...
    PDQ_SetDemand($PCarray[0]->label, $txRQ, $demand[RQ_REQ][PC] + 3 * $demand[RQ_RPY][PC]);
    // PDQ_SetDemand($PCarray[1]->label, $dumRQ,($demand[RQ_REQ][PC] + (3 * $demand[RQ_RPY][PC])) / (USERS - 1));
    PDQ_SetDemand("FS", $txRQ, $demand[REQ_RQ][FS] + 3 * $demand[RQ_MSG][FS]);
    PDQ_SetDemand("FS", $dumRQ, $demand[REQ_RQ][FS] + 3 * $demand[RQ_MSG][FS]);
    for ($i = 0; $i < FS_DISKS; $i++) {
        PDQ_SetDemand($FDarray[$i]->label, $txRQ, $demand[REQ_RQ][$FDarray[$i]->id] + 3 * $demand[RQ_MSG][$FDarray[$i]->id]);
        PDQ_SetDemand($FDarray[$i]->label, $dumRQ, $demand[REQ_RQ][$FDarray[$i]->id] + 3 * $demand[RQ_MSG][$FDarray[$i]->id]);
    }
    PDQ_SetDemand("GW", $txRQ, $demand[GT_SND][GW] + 3 * $demand[GT_RCV][GW]);
    PDQ_SetDemand("GW", $dumRQ, $demand[GT_SND][GW] + 3 * $demand[GT_RCV][GW]);
    PDQ_SetDemand("MF", $txRQ, $demand[MF_RQ][MF]);
    PDQ_SetDemand("MF", $dumRQ, $demand[MF_RQ][MF]);
    for ($i = 0; $i < MF_DISKS; $i++) {
        PDQ_SetDemand($MDarray[$i]->label, $txRQ, $demand[MF_RQ][$MDarray[$i]->id]);
        PDQ_SetDemand($MDarray[$i]->label, $dumRQ, $demand[MF_RQ][$MDarray[$i]->id]);
    }
    PDQ_SetDemand("TR", $txRQ, 1 * $demand[LAN_TX][PC] + 1 * $demand[LAN_TX][FS] + 3 * $demand[LAN_TX][GW] + 3 * $demand[LAN_TX][FS]);
    PDQ_SetDemand("TR", $dumRQ, 1 * $demand[LAN_TX][PC] + 1 * $demand[LAN_TX][FS] + 3 * $demand[LAN_TX][GW] + 3 * $demand[LAN_TX][FS]);
    // SU request + reply chain  ...
    PDQ_SetDemand($PCarray[0]->label, $txSU, $demand[SU_REQ][PC] + $demand[SU_RPY][PC]);
    // PDQ_SetDemand($PCarray[1]->label, $dumSU,(($demand[SU_REQ][PC] + $demand[SU_RPY][PC])) / (USERS - 1));
    PDQ_SetDemand("TR", $txSU, $demand[LAN_TX][PC]);
    PDQ_SetDemand("TR", $dumSU, $demand[LAN_TX][PC]);
    PDQ_SetDemand("FS", $txSU, $demand[REQ_SU][FS] + $demand[SU_MSG][FS]);
    PDQ_SetDemand("FS", $dumSU, $demand[REQ_SU][FS] + $demand[SU_MSG][FS]);
    for ($i = 0; $i < FS_DISKS; $i++) {
        PDQ_SetDemand($FDarray[$i]->label, $txSU, $demand[REQ_SU][$FDarray[$i]->id] + $demand[SU_MSG][$FDarray[$i]->id]);
        PDQ_SetDemand($FDarray[$i]->label, $dumSU, $demand[REQ_SU][$FDarray[$i]->id] + $demand[SU_MSG][$FDarray[$i]->id]);
    }
    PDQ_SetDemand("TR", $txSU, $demand[LAN_TX][FS]);
    PDQ_SetDemand("TR", $dumSU, $demand[LAN_TX][FS]);
    PDQ_SetDemand("GW", $txSU, $demand[GT_SND][GW] + $demand[GT_RCV][GW]);
    PDQ_SetDemand("GW", $dumSU, $demand[GT_SND][GW] + $demand[GT_RCV][GW]);
    PDQ_SetDemand("MF", $txSU, $demand[MF_SU][MF]);
    PDQ_SetDemand("MF", $dumSU, $demand[MF_SU][MF]);
    for ($i = 0; $i < MF_DISKS; $i++) {
        PDQ_SetDemand($MDarray[$i]->label, $txSU, $demand[MF_SU][$MDarray[$i]->id]);
        PDQ_SetDemand($MDarray[$i]->label, $dumSU, $demand[MF_SU][$MDarray[$i]->id]);
    }
    PDQ_SetDemand("TR", $txSU, 1 * $demand[LAN_TX][PC] + 1 * $demand[LAN_TX][FS] + 1 * $demand[LAN_TX][GW] + 1 * $demand[LAN_TX][FS]);
    PDQ_SetDemand("TR", $dumSU, 1 * $demand[LAN_TX][PC] + 1 * $demand[LAN_TX][FS] + 1 * $demand[LAN_TX][GW] + 1 * $demand[LAN_TX][FS]);
    PDQ_Solve(CANON);
    PDQ_Report();
    // Break out Tx response times and device utilizations ...
    printf("*** PDQ Breakout \"%s\" (%d clients) ***\n\n", $scenario, USERS);
    for ($dev = 0; $dev < $noNodes; $dev++) {
        $util[$dev] = 0.0;
        /* reset array */
        for ($work = 0; $work < $noStreams; $work++) {
            $util[$dev] += 100 * PDQ_GetUtilization($node[$dev]->devname, $job[$work]->trans->name, TRANS);
        }
    }
    printf("Transaction  \tLatency(Secs)\n");
    printf("-----------  \t-----------\n");
    for ($work = 0; $work < $noStreams; $work++) {
        printf("%s\t%7.4f\n", $job[$work]->trans->name, $job[$work]->trans->sys->response);
    }
    printf("\n\n");
    for ($dev = 0; $dev < $noNodes; $dev++) {
        // for ($i = 0; $i < USERS; $i++)
        for ($i = 0; $i < 2; $i++) {
            if ($node[$dev]->devname == $PCarray[$i]->label) {
                $upc[$i] += $util[$dev];
            }
            // SZ NOTE: In the original C version you use upc but you have never initialized it!!
        }
        if ($node[$dev]->devname == "GW") {
            $ugw += $util[$dev];
        }
        if ($node[$dev]->devname == "FS") {
            $ufs += $util[$dev];
        }
        for ($i = 0; $i < FS_DISKS; $i++) {
            if ($node[$dev]->devname == $FDarray[$i]->label) {
                $udsk[$i] += $util[$dev];
            }
            // SZ NOTE: In the original C version you use udsk but you have never initialized it!!
        }
        if ($node[$dev]->devname == "MF") {
            $umf += $util[$dev];
        }
        for ($i = 0; $i < MF_DISKS; $i++) {
            if ($node[$dev]->devname == $MDarray[$i]->label) {
                $udasd[$i] += $util[$dev];
            }
            // SZ NOTE: In the original C version you use udasd but you have never initialized it!!
        }
        if ($node[$dev]->devname == "TR") {
            $ulan += $util[$dev];
        }
    }
    printf("Node      \t%% Utilization\n");
    printf("----      \t--------------\n");
    printf("%s\t%7.4f\n", "Token Ring ", $ulan);
    printf("%s\t%7.4f\n", "Desktop PC ", $upc[0]);
    printf("%s\t%7.4f\n", "FileServer ", $ufs);
    for ($i = 0; $i < FS_DISKS; $i++) {
        printf("%s%d\t%7.4f\n", "FS Disk", $FDarray[$i]->id, $udsk[$i]);
    }
    printf("%s\t%7.4f\n", "Gateway SNA", $ugw);
    printf("%s\t%7.4f\n", "Mainframe  ", $umf);
    for ($i = 0; $i < MF_DISKS; $i++) {
        printf("%s%d\t%7.4f\n", "MFrame DASD", $MDarray[$i]->id, $udasd[$i]);
    }
}
Example #16
0
function main($argc, $argv)
{
    global $nodes, $streams;
    // this are global to PDQ_Lib
    $k = 0;
    // Waring!! k is a global variable in the PDQ_Lib!!!
    $sol_mode = APPROX;
    $sol_name = "APPROX";
    $name = "";
    $nstr = "";
    /* input parameters */
    $think = 10.0;
    $users = 300;
    // 800;
    $Sifp = 0.1;
    $Samp = 0.6;
    $Sdsu = 1.2;
    $Nifp = 15;
    $Namp = 50;
    $Ndsu = 100;
    if ($argc == 2) {
        if ($argv[1] == "APPROX") {
            $sol_name = $argv[1];
            $sol_mode = APPROX;
        } else {
            if ($argv[1] == "EXACT") {
                $sol_name = $argv[1];
                $sol_mode = EXACT;
            }
        }
    }
    //PDQ_SetDebug(TRUE);
    PDQ_Init("Teradata DBC-10/12");
    /* Create parallel centers */
    for ($k = 0; $k < $Nifp; $k++) {
        $name = sprintf("IFP%d", $k);
        $nodes = PDQ_CreateNode($name, CEN, FCFS);
    }
    for ($k = 0; $k < $Namp; $k++) {
        $name = sprintf("AMP%d", $k);
        $nodes = PDQ_CreateNode($name, CEN, FCFS);
    }
    for ($k = 0; $k < $Ndsu; $k++) {
        $name = sprintf("DSU%d", $k);
        $nodes = PDQ_CreateNode($name, CEN, FCFS);
    }
    $streams = PDQ_CreateClosed("query", TERM, (double) $users, $think);
    /*PDQ_SetGraph("query", 100); - unsupported call */
    for ($k = 0; $k < $Nifp; $k++) {
        $name = sprintf("IFP%d", $k);
        PDQ_SetDemand($name, "query", $Sifp / $Nifp);
    }
    for ($k = 0; $k < $Namp; $k++) {
        $name = sprintf("AMP%d", $k);
        PDQ_SetDemand($name, "query", $Samp / $Namp);
    }
    for ($k = 0; $k < $Ndsu; $k++) {
        $name = sprintf("DSU%d", $k);
        PDQ_SetDemand($name, "query", $Sdsu / $Ndsu);
    }
    /* 300 nodes takes about a minute to solve on a PowerMac */
    printf("Solving %s... ", $sol_name);
    PDQ_Solve($sol_mode);
    printf("Done.\n");
    /* PDQ_PrintXLS();  - unsupported call */
    PDQ_Report();
}
Example #17
0
function main()
{
    global $nodes, $streams;
    $cname = "";
    /* cache id */
    $wname = "";
    /* workload */
    $i = 0;
    /* per CPU intruction stream intensity */
    $Prhit = RD * HT;
    $Pwhit = WR * HT * (1 - WUMD) + WR * (1 - HT) * (1 - MD);
    $Prdop = RD * (1 - HT);
    $Pwbop = WR * (1 - HT) * MD;
    $Pwthr = WR;
    $Pinvl = WR * HT * WUMD;
    $Nrwht = 0.8075 * MAXCPU;
    $Nrdop = 0.08500000000000001 * MAXCPU;
    $Nwthr = 0.15 * MAXCPU;
    $Nwbop = 0.0003 * MAXCPU * 100;
    $Ninvl = 0.015 * MAXCPU;
    $Srdop = 20.0;
    $Swthr = 25.0;
    $Swbop = 20.0;
    $Wrwht = 0.0;
    $Wrdop = 0.0;
    $Wwthr = 0.0;
    $Wwbop = 0.0;
    $Winvl = 0.0;
    $Zrwht = ZX;
    $Zrdop = ZX;
    $Zwbop = ZX;
    $Zinvl = ZX;
    $Zwthr = ZX;
    $Xcpu = 0.0;
    $Pcpu = 0.0;
    $Ubrd = 0.0;
    $Ubwr = 0.0;
    $Ubin = 0.0;
    $Ucht = 0.0;
    $Ucrd = 0.0;
    $Ucwr = 0.0;
    $Ucin = 0.0;
    $model = "ABC Model";
    PDQ_Init($model);
    PDQ_SetWUnit("Reqs");
    PDQ_SetTUnit("Cycs");
    /* create single bus queueing center */
    $nodes = PDQ_CreateNode(BUS, CEN, FCFS);
    /* create per CPU cache queueing centers */
    for ($i = 0; $i < MAXCPU; $i++) {
        namex($i, L2C, $cname);
        $nodes = PDQ_CreateNode($cname, CEN, FCFS);
    }
    /* create CPU nodes, workloads, and demands */
    for ($i = 0; $i < intwt($Nrwht, $Wrwht); $i++) {
        namex($i, RWHT, $wname);
        $streams = PDQ_CreateClosed($wname, TERM, $Nrwht, $Zrwht);
        namex($i, L2C, $cname);
        PDQ_SetDemand($cname, $wname, 1.0);
        PDQ_SetDemand(BUS, $wname, 0.0);
        /* no bus activity */
    }
    for ($i = 0; $i < intwt($Nrdop, $Wrdop); $i++) {
        namex($i, RDOP, $wname);
        $streams = PDQ_CreateClosed($wname, TERM, $Nrdop, $Zrdop);
        namex($i, L2C, $cname);
        PDQ_SetDemand($cname, $wname, GEN);
        /* generate bus request */
        PDQ_SetDemand(BUS, $wname, $Srdop);
        /* req + async data return */
    }
    if (WBACK) {
        for ($i = 0; $i < intwt($Nwbop, $Wwbop); $i++) {
            namex($i, WROP, $wname);
            $streams = PDQ_CreateClosed($wname, TERM, $Nwbop, $Zwbop);
            namex($i, L2C, $cname);
            PDQ_SetDemand($cname, $wname, GEN);
            PDQ_SetDemand(BUS, $wname, $Swbop);
            /* asych write to memory ? */
        }
    } else {
        /* write-thru */
        for ($i = 0; $i < intwt($Nwthr, $Wwthr); $i++) {
            namex($i, WROP, $wname);
            $streams = PDQ_CreateClosed($wname, TERM, $Nwthr, $Zwthr);
            namex($i, L2C, $cname);
            PDQ_SetDemand($cname, $wname, GEN);
            PDQ_SetDemand(BUS, $wname, $Swthr);
        }
    }
    if (WBACK) {
        for ($i = 0; $i < intwt($Ninvl, $Winvl); $i++) {
            namex($i, INVL, $wname);
            $streams = PDQ_CreateClosed($wname, TERM, $Ninvl, $Zinvl);
            namex($i, L2C, $cname);
            PDQ_SetDemand($cname, $wname, GEN);
            /* GEN + intervene */
            PDQ_SetDemand(BUS, $wname, 1.0);
        }
    }
    PDQ_Solve(APPROX);
    /* bus utilizations */
    for ($i = 0; $i < intwt($Nrdop, $Wrdop); $i++) {
        namex($i, RDOP, $wname);
        $Ubrd += PDQ_GetUtilization(BUS, $wname, TERM);
    }
    $Ubrd *= $Wrdop;
    if (WBACK) {
        for ($i = 0; $i < intwt($Nwbop, $Wwbop); $i++) {
            namex($i, WROP, $wname);
            $Ubwr += PDQ_GetUtilization(BUS, $wname, TERM);
        }
        $Ubwr *= $Wwbop;
        for ($i = 0; $i < intwt($Ninvl, $Winvl); $i++) {
            namex($i, INVL, $wname);
            $Ubin += PDQ_GetUtilization(BUS, $wname, TERM);
        }
        $Ubin *= $Winvl;
    } else {
        /* write-thru */
        for ($i = 0; $i < intwt($Nwthr, $Wwthr); $i++) {
            namex($i, WROP, $wname);
            $Ubwr += PDQ_GetUtilization(BUS, $wname, TERM);
        }
        $Ubwr *= $Wwthr;
    }
    /* cache measures at CPU[0] only */
    $i = 0;
    namex($i, L2C, $cname);
    namex($i, RWHT, $wname);
    $Xcpu = PDQ_GetThruput(TERM, $wname) * $Wrwht;
    $Pcpu += $Xcpu * $Zrwht;
    $Ucht = PDQ_GetUtilization($cname, $wname, TERM) * $Wrwht;
    namex($i, RDOP, $wname);
    $Xcpu = PDQ_GetThruput(TERM, $wname) * $Wrdop;
    $Pcpu += $Xcpu * $Zrdop;
    $Ucrd = PDQ_GetUtilization($cname, $wname, TERM) * $Wrdop;
    $Pcpu *= 1.88;
    if (WBACK) {
        namex($i, WROP, $wname);
        $Ucwr = PDQ_GetUtilization($cname, $wname, TERM) * $Wwbop;
        namex($i, INVL, $wname);
        $Ucin = PDQ_GetUtilization($cname, $wname, TERM) * $Winvl;
    } else {
        /* write-thru */
        namex($i, WROP, $wname);
        $Ucwr = PDQ_GetUtilization($cname, $wname, TERM) * $Wwthr;
    }
    printf("\n**** %s Results ****\n", $model);
    printf("PDQ nodes: %d  PDQ streams: %d\n", $nodes, $streams);
    printf("Memory Mode: %s\n", WBACK ? "WriteBack" : "WriteThru");
    printf("Ncpu:  %2d\n", MAXCPU);
    printf("Nrwht: %5.2f (N:%2d  W:%5.2f)\n", $Nrwht, intwt($Nrwht, $Wrwht), $Wrwht);
    printf("Nrdop: %5.2f (N:%2d  W:%5.2f)\n", $Nrdop, intwt($Nrdop, $Wrdop), $Wrdop);
    if (WBACK) {
        printf("Nwbop: %5.2f (N:%2d  W:%5.2f)\n", $Nwbop, intwt($Nwbop, $Wwbop), $Wwbop);
        printf("Ninvl: %5.2f (N:%2d  W:%5.2f)\n", $Ninvl, intwt($Ninvl, $Winvl), $Winvl);
    } else {
        printf("Nwthr: %5.2f (N:%2d  W:%5.2f)\n", $Nwthr, intwt($Nwthr, $Wwthr), $Wwthr);
    }
    printf("\n");
    printf("Hit Ratio:   %5.2f %%\n", HT * 100.0);
    printf("Read Miss:   %5.2f %%\n", RD * (1 - HT) * 100.0);
    printf("WriteMiss:   %5.2f %%\n", WR * (1 - HT) * 100.0);
    printf("Ucpu:        %5.2f %%\n", $Pcpu * 100.0 / MAXCPU);
    printf("Pcpu:        %5.2f\n", $Pcpu);
    printf("\n");
    printf("Ubus[reads]: %5.2f %%\n", $Ubrd * 100.0);
    printf("Ubus[write]: %5.2f %%\n", $Ubwr * 100.0);
    printf("Ubus[inval]: %5.2f %%\n", $Ubin * 100.0);
    printf("Ubus[total]: %5.2f %%\n", ($Ubrd + $Ubwr + $Ubin) * 100.0);
    printf("\n");
    printf("Uca%d[hits]:  %5.2f %%\n", $i, $Ucht * 100.0);
    printf("Uca%d[reads]: %5.2f %%\n", $i, $Ucrd * 100.0);
    printf("Uca%d[write]: %5.2f %%\n", $i, $Ucwr * 100.0);
    printf("Uca%d[inval]: %5.2f %%\n", $i, $Ucin * 100.0);
    printf("Uca%d[total]: %5.2f %%\n", $i, ($Ucht + $Ucrd + $Ucwr + $Ucin) * 100.0);
}
Example #18
0
function main()
{
    global $job;
    $noNodes = 0;
    $noStreams = 0;
    $users = 0;
    $delta = 0;
    $model = "IIS Server";
    $work = "http GET 20KB";
    $node1 = "CPU";
    $node2 = "DSK";
    $node3 = "NET";
    $node4 = "Dummy";
    $think = 1.5 * 0.001;
    $u2demand = 0.1 * 0.001;
    $u1pdq = array(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
    // array of double [11]
    $u2pdq = array(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
    // array of double [11]
    $u3pdq = array(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
    // array of double [11]
    $u1err = array(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
    // array of double [11]
    $u2err = array(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
    // array of double [11]
    $u3err = array(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
    // array of double [11]
    // Utilization data from the paper ...
    $u1dat = array(0.0, 9.0, 14.0, 17.0, 21.0, 24.0, 26.0, 0.0, 0.0, 0.0, 26.0);
    // this can cause division by zero error
    $u2dat = array(0.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 0.0, 0.0, 0.0, 2.0);
    // this can cause division by zero error
    $u3dat = array(0.0, 26.0, 46.0, 61.0, 74.0, 86.0, 92.0, 0.0, 0.0, 0.0, 94.0);
    // this can cause division by zero error
    // Output main header ...
    printf("\n");
    printf("(Tx: \"%s\" for \"%s\")\n\n", $work, $model);
    printf("Client delay Z=%5.2f mSec. (Assumed)\n\n", $think * 1000.0);
    printf("%3s\t%6s  %6s   %6s  %6s  %6s\n", " N ", "  X  ", "  R  ", "%Ucpu", "%Udsk", "%Unet");
    printf("%3s\t%6s  %6s   %6s  %6s  %6s\n", "---", "------", "------", "------", "------", "------");
    for ($users = 1; $users <= 10; $users++) {
        PDQ_Init($model);
        $noStreams = PDQ_CreateClosed($work, TERM, (double) $users, $think);
        $noNodes = PDQ_CreateNode($node1, CEN, FCFS);
        $noNodes = PDQ_CreateNode($node2, CEN, FCFS);
        $noNodes = PDQ_CreateNode($node3, CEN, FCFS);
        $noNodes = PDQ_CreateNode($node4, CEN, FCFS);
        // NOTE: timebase is seconds
        PDQ_SetDemand($node1, $work, 0.44 * 0.001);
        PDQ_SetDemand($node2, $work, $u2demand);
        /* make load-indept */
        PDQ_SetDemand($node3, $work, 1.45 * 0.001);
        PDQ_SetDemand($node4, $work, 1.6 * 0.001);
        PDQ_Solve(EXACT);
        // set up for error analysis of utilzations
        $u1pdq[$users] = PDQ_GetUtilization($node1, $work, TERM) * 100;
        $u2pdq[$users] = PDQ_GetUtilization($node2, $work, TERM) * 100;
        $u3pdq[$users] = PDQ_GetUtilization($node3, $work, TERM) * 100;
        $u1err[$users] = 100 * ($u1pdq[$users] - $u1dat[$users]) / $u1dat[$users];
        // raise division by zero error!!
        $u2err[$users] = 100 * ($u2pdq[$users] - $u2dat[$users]) / $u2dat[$users];
        // raise division by zero error!!
        $u3err[$users] = 100 * ($u3pdq[$users] - $u3dat[$users]) / $u3dat[$users];
        // raise division by zero error!!
        $u2demand = 0.015 / PDQ_GetThruput(TERM, $work);
        /* http GETs-per-second */
        /* milliseconds */
        printf("%3d\t%6.2f  %6.2f   %6.2f  %6.2f  %6.2f\n", $users, PDQ_GetThruput(TERM, $work), PDQ_GetResponse(TERM, $work) * 1000.0, $u1pdq[$users], $u2pdq[$users], $u3pdq[$users]);
    }
    printf("\nError Analysis of Utilizations\n\n");
    printf("%3s\t%12s  %12s  %12s\n", "   ", "         CPU          ", "         DSK          ", "         NET          ");
    printf("%3s\t%12s  %12s  %12s\n", "   ", "----------------------", "----------------------", "----------------------");
    printf("%3s    ", " N ");
    printf("%6s  %6s  %6s  ", "%Udat", "%Updq", "%Uerr");
    printf("%6s  %6s  %6s  ", "%Udat", "%Updq", "%Uerr");
    printf("%6s  %6s  %6s\n", "%Udat", "%Updq", "%Uerr");
    printf("%3s    ", "---");
    printf("%6s  %6s  %6s  ", "-----", "-----", "-----");
    printf("%6s  %6s  %6s  ", "-----", "-----", "-----");
    printf("%6s  %6s  %6s\n", "-----", "-----", "-----");
    for ($users = 1; $users <= 10; $users++) {
        if ($users <= 6 || $users == 10) {
            printf("%3d\t%5.2f\t%5.2f\t%5.2f", $users, $u1dat[$users], $u1pdq[$users], $u1err[$users]);
            printf("\t%5.2f\t%5.2f\t%5.2f", $u2dat[$users], $u2pdq[$users], $u2err[$users]);
            printf("\t%5.2f\t%5.2f\t%5.2f\n", $u3dat[$users], $u3pdq[$users], $u3err[$users]);
        }
    }
    printf("\n");
}