Exemplo n.º 1
0
function GetProdU()
{
    $noNodes = 0;
    $noStreams = 0;
    PDQ_Init("");
    $noStreams = PDQ_CreateClosed("Production", TERM, 20.0, 20.0);
    $noNodes = PDQ_CreateNode("CPU", CEN, FCFS);
    $noNodes = PDQ_CreateNode("DK1", CEN, FCFS);
    $noNodes = PDQ_CreateNode("DK2", CEN, FCFS);
    PDQ_SetDemand("CPU", "Production", 0.3);
    PDQ_SetDemand("DK1", "Production", 0.08);
    PDQ_SetDemand("DK2", "Production", 0.1);
    PDQ_Solve(APPROX);
    return PDQ_GetUtilization("CPU", "Production", TERM);
}
Exemplo n.º 2
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]);
    }
}
Exemplo n.º 3
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();
}
Exemplo n.º 4
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);
}
Exemplo n.º 5
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");
}