performance data修改相关代码记录

include("picmaker.php");
        $cmd="/usr/sbin/daperf -vd ".$VDname." -dg ".$DGname." -points ".PAGE_POINTS." ".$cmd_op." -both -owneronly -noheader | awk -F \" \"  '{print $1 \"\\n\" $2}'";
        $cmd1="/usr/sbin/daperf -vd ".$VDname." -dg ".$DGname." -points ".PAGE_POINTS." -readrate -both -owneronly -noheader | awk -F \" \"  '{print $1 \"\\n\" $2}'";
        $cmd2="/usr/sbin/daperf -vd ".$VDname." -dg ".$DGname." -points ".PAGE_POINTS." -writerate -both -owneronly -noheader | awk -F \" \"  '{print $1 \"\\n\" $2}'";
        $cmd3="/usr/sbin/daperf -vd ".$VDname." -dg ".$DGname." -points ".PAGE_POINTS." -readcomptime -both -owneronly -noheader | awk -F \" \"  '{print $1 \"\\n\" $2}'";
        $cmd4="/usr/sbin/daperf -vd ".$VDname." -dg ".$DGname." -points ".PAGE_POINTS." -writecomptime -both -owneronly -noheader | awk -F \" \"  '{print $1 \"\\n\" $2}'";
        $yValue=explode("\n",`$cmd`);
        $yValue1=explode("\n",`$cmd1`);
        $yValue2=explode("\n",`$cmd2`);
        $yValue3=explode("\n",`$cmd3`);
        $yValue4=explode("\n",`$cmd4`);
        $sum_yValue=0;
        $sum_yValue1=0;
        $sum_yValue2=0;
        $sum_yValue3=0;
        $sum_yValue4=0;
        for($i=0;$i<PAGE_POINTS;$i++) {
            $sum_yValue+=$yValue[2*$i+1];
            $sum_yValue1+=$yValue1[2*$i+1];
            $sum_yValue2+=$yValue2[2*$i+1];
            $sum_yValue3+=$yValue3[2*$i+1];
            $sum_yValue4+=$yValue4[2*$i+1];
        }
        //print_r($yValue);
        if($sum_yValue==0 && $scp==1){
            $cmd="/usr/sbin/daperf -vd ".$VDname." -dg ".$DGname." -points ".PAGE_POINTS." ".$cmd_op." -both -otheronly -noheader | awk -F \" \"  '{print $1 \"\\n\" $2}'";
            $cmd1="/usr/sbin/daperf -vd ".$VDname." -dg ".$DGname." -points ".PAGE_POINTS." -readrate -both -otheronly -noheader | awk -F \" \"  '{print $1 \"\\n\" $2}'";
            $cmd2="/usr/sbin/daperf -vd ".$VDname." -dg ".$DGname." -points ".PAGE_POINTS." -writerate -both -otheronly -noheader | awk -F \" \"  '{print $1 \"\\n\" $2}'";
            $cmd3="/usr/sbin/daperf -vd ".$VDname." -dg ".$DGname." -points ".PAGE_POINTS." -readcomptime -both -otheronly -noheader | awk -F \" \"  '{print $1 \"\\n\" $2}'";
            $cmd4="/usr/sbin/daperf -vd ".$VDname." -dg ".$DGname." -points ".PAGE_POINTS." -writecomptime -both -otheronly -noheader | awk -F \" \"  '{print $1 \"\\n\" $2}'";
            //print_r($cmd);
            $yValue=explode("\n",`$cmd`);
            $yValue1=explode("\n",`$cmd1`);
            $yValue2=explode("\n",`$cmd2`);
            $yValue3=explode("\n",`$cmd3`);
            $yValue4=explode("\n",`$cmd4`);
        }

        //print_r($yValue);
        if(!strcmp($vdType,"lba")){
            $maxValue=max($yValue);
            if($maxValue>100000 || $maxValue==100000){
                for($i=0;$i<PAGE_POINTS;$i++)
                    $yValue[2*$i+1]=$yValue[2*$i+1]/(pow(10,6));
                $yaxis="LBA*10^6 (Sectors)";
            }
        }
        $l->SetTitle($title);
        $l->SetYaxisTitle($yaxis);
        for($i=0;$i<PAGE_POINTS;$i++){
            if(!strcmp($vdType,"readrate")){
                $l->AddValue(array($yValue1[2*$i],$yValue2[2*$i]), array($yValue1[2*$i+1],$yValue2[2*$i+1]));
            } else if (!strcmp($vdType,"comptime")){
              if (!strcmp($group1, "1"))
                $l->AddValue(array($yValue[2*$i]), array($yValue[2*$i+1]));
              else
                $l->AddValue(array($yValue3[2*$i],$yValue4[2*$i]), array($yValue3[2*$i+1],$yValue4[2*$i+1]));

            } else if (!strcmp($vdType,"lba")){
                $l->AddValue(array($yValue[2*$i]), array($yValue[2*$i+1]));

            }
        }
        $ArrTitle=Array();
        if($group1=="2" || $vdType=="readrate"){
            $ArrTitle[0]="read";
            $ArrTitle[1]="write";
        }
        $l->spit("png",$xtime,$yaxisNum,$ArrTitle);


        break;
    case "cpu":
        $local_cores="2";
        $remote_cores="2";
        if($controller==2||(int)$id==(int)$controller){
            $local_cores=`cat /proc/cpuinfo |awk 'NR==12 {print $4}'`;
        }
        if($controller==2||(int)$id!=(int)$controller){

            $remote_cores=`rsh -t 120 c$rid cat /proc/cpuinfo | /bin/awk 'NR==12 {print $4}'`;
        }

        $title="CPU Busy Percentage";
        $cmd_op="-cpubusy";
        $cmd="/usr/sbin/daperf ".$conOp." -points ".PAGE_POINTS." ".$cmd_op." -noheader";
        $l->SetTitle($title);
        $l->SetYaxisTitle("CPU Busy Percentage");
        $yValue=explode("\n",`$cmd`);

        //print_r($yValue);
        for($i=0;$i<PAGE_POINTS;$i++){
            $t1=array();
            $v1=array();
            $tmp1=strtok(trim($yValue[$i])," \t\n");

            if($controller!=2&&(int)$id==(int)$controller){
                for($n=0;$n<(int)$local_cores;$n++){
                    array_push($t1, $tmp1);
                    $tmp2=strtok(" \t\n");
                    array_push($v1, $tmp2);
                }
                $l->AddValue($t1, $v1);
            }
            if($controller!=2&&(int)$id!=(int)$controller){
                for($n=0;$n<(int)$remote_cores;$n++){
                    array_push($t1, $tmp1);
                    $tmp2=strtok(" \t\n");
                    array_push($v1, $tmp2);
                }
                $l->AddValue($t1, $v1);
            }
            if($controller==2){

                if(trim($id)=='0'){
                    for($n=0;$n<(int)$local_cores;$n++){
                        array_push($t1, $tmp1);
                        $tmp2=strtok(" \t\n");
                        array_push($v1, $tmp2);
                    }
                    $tmp4=strtok(" \t\n");
                    for($n=0;$n<(int)$remote_cores;$n++){
                        array_push($t1, $tmp4);
                        $tmp5=strtok(" \t\n");
                        array_push($v1, $tmp5);
                    }
                    $l->AddValue($t1, $v1);

                }else{
                    for($n=0;$n<(int)$remote_cores;$n++){
                        array_push($t1, $tmp1);
                        $tmp2=strtok(" \t\n");
                        array_push($v1, $tmp2);
                    }
                    $tmp4=strtok(" \t\n");
                    for($n=0;$n<(int)$local_cores;$n++){
                        array_push($t1, $tmp4);
                        $tmp5=strtok(" \t\n");
                        array_push($v1, $tmp5);
                    }
                    $l->AddValue($t1, $v1);
                }

            }

        }
        $ArrTitle=Array();
        if($controller!=2&&(int)$id==(int)$controller){
            for($n=0;$n<(int)$local_cores;$n++){
                array_push($ArrTitle, "CPU".$n);
            }
        }
        if($controller!=2&&(int)$id!=(int)$controller){
            for($n=0;$n<(int)$remote_cores;$n++){
                array_push($ArrTitle, "CPU".$n);
            }
        }
        if($controller==2){
            if(trim($id)=='0'){
                for($n=0;$n<(int)$local_cores;$n++){
                    array_push($ArrTitle, "C".$tmp_id[0]." CPU".$n);
                }
                for($n=0;$n<(int)$remote_cores;$n++){
                    array_push($ArrTitle, "C".$rid." CPU".$n);
                }
            }else{
                for($n=0;$n<(int)$remote_cores;$n++){
                    array_push($ArrTitle, "C".$rid." CPU".$n);
                }
                for($n=0;$n<(int)$local_cores;$n++){
                    array_push($ArrTitle, "C".$tmp_id[0]." CPU".$n);
                }
            }
        }
        $l->spit("png",$xtime,$yaxisNum,$ArrTitle,1);
        break;
}

        <h1><? echo convert("performance_data");?></h1><h1 class="floatRight"> </h1>
    </div>
    <hr />
    <div class="contentBody">
        <form action="performanceMonitoringPlot.php" method="post" id="form1" name="form1">
            <input id="time" name="time" type=hidden value="5">
            <input id="controller" name="controller" type=hidden value="<?= $controller ?>">
            <div class="module">
                <h3><? echo convert("data_to_plot");?></h3>
                <div class="row">
                        <div class="value"><input type="radio" id="type1" name="type" value="vd" οnclick="DisplaySelect()"/><? echo convert("vd_performance");?></div>                                  
                        <div class="value" id="vdPerformance" name="vdPerformance" style="display:none;padding-left:20px;padding-top:10px;">
                        <div style="padding-top:5px;"><? echo convert("select_dg");?>:
                        <select name="DGname" id="DGname" style="width:200px" οnchange="myselect(this.value);">
                            <option value=""></option>
                        </select></div>
                        <div style="padding-top:5px;"><? echo convert("select_vd");?>:         
                        <select name="VDname" id="VDname" style="width:200px">
                            <option value=""></option>
                        </select></div>
                        <div style="padding-top:5px;"><? echo convert("select_performance_data");?>:                                             
                        <select id="vdType" name="vdType" style="width:200px" οnchange="change(this.value);">
                            <option value="comptime"><? echo convert("disk_latency");?></option>
                            <option value="readrate"><? echo convert("read_rate");?></option>
                            <option value="lba"><? echo convert("sector_address");?></option>
                        </select></div>
                            <div class="row" id="_cp" name="cp" style="display:block;">
                            <div style="padding-top:5px;" class="label">Combined</div>
                            <div class="value"> <input type="radio"  name="group1" value="1"></div>
                            <div style="padding-top:5px;" class="label">Read/Write</div>
                            <div class="value"> <input type="radio"  name="group1" value="2"></div>
                            </div>
                        </div>
                </div>

/*function mytest(obj)
     {
        var x = document.getElementById("vdType").selectedIndex;
        if(document.getElementsByTagName("option")[x].value == "readrate" || document.getElementsByTagName("option")[x].value == "lba"){
            document.getElementById("comp").checked=false;
            document.getElementById("comptest").style.display="none";
        }else{
            document.getElementById("comptest").style.display="block";
        }
     }
*/
function change(obj)
    {
        if(obj=="comptime")
          $("#_cp").show()
        else
          $("#_cp").hide()
    } 

  6   remember_page("../System/performanceMonitoringPlot.php?time=$time&type=$type&controller=$controller&vdType=$vdType&cache=$cache&DGname=$DGname&VDname=$    VDname&group1=$group1");

 81 <?php
 82     echo "imgshow.src ='srcPerMonitor.php?type=$type&controller=$controller&vdType=$vdType&cache=$cache&DGname=$DGname&VDname=$VDname&pbufMc=1&group1=$gr    oup1';";
 83     if(!strcmp($type,"pbufMc")){
 84         echo "var imgshow2=new Image();";
 85         echo "imgshow2.src ='srcPerMonitor.php?type=$type&controller=$controller&vdType=$vdType&cache=$cache&DGname=$DGname&VDname=$VDname&pbufMc=2&group    1=$group1';";
 86     }
 87 ?>

Long-Term performance data代码相关

1.时间控件

<script type="text/javascript" src="../inc/My97DatePicker/WdatePicker.js"></script>
<input type="text" name="longtermtime" id="longtermtime" style="width:130px;height:18px" value="<?php echo isset($date)?$date:'Select time'; ?>" onfo    cus="WdatePicker({dateFmt:'MM/dd/yyyy - HH:mm:ss',maxDate:'%y-%M-%d',minDate:'%y-%M-%d #{%H-25}:%m:%s'})"/>


2.

        //write xValueOfDate
        $cmd_date1="date \"+%x %T\" -d '".$checktime."'";
        $checkdate1_tmp=explode("\n",`$cmd_date1`);
        $checkdate1=explode(" ",$checkdate1_tmp[0]);
        $cmd_date2="date \"+%x %T\" -d '".$checktime." 5 minutes'";
        $checkdate2_tmp=explode("\n",`$cmd_date2`);
        $checkdate2=explode(" ",$checkdate2_tmp[0]);
        $cmd_date3="date \"+%x %T\" -d '".$checktime." 10 minutes'";
        $checkdate3_tmp=explode("\n",`$cmd_date3`);
        $checkdate3=explode(" ",$checkdate3_tmp[0]);
        $cmd_date4="date \"+%x %T\" -d '".$checktime." 15 minutes'";
        $checkdate4_tmp=explode("\n",`$cmd_date4`);
        $checkdate4=explode(" ",$checkdate4_tmp[0]);
        $cmd_date5="date \"+%x %T\" -d '".$checktime." 20 minutes'";
        $checkdate5_tmp=explode("\n",`$cmd_date5`);
        $checkdate5=explode(" ",$checkdate5_tmp[0]);

        $resultDate=array_merge($checkdate1,$checkdate2,$checkdate3,$checkdate4,$checkdate5);

/* picmaker.php */
       // put the series legend
        $legendHeight = ImageFontHeight(3);
        if($xDateValue==1) {
            if(count($icon)<=4){
                $legendWidth = ImageFontWidth(3) * strlen("Time");
                ImageString($this->image, 3, $this->width - 100+10, $this->height - 45, "Time", $this->titleCol);
                $legendWidth = ImageFontWidth(3) * strlen("(hr:min:sec)");
                ImageString($this->image, 3, $this->width - 100+10, $this->height - 40+$legendHeight, "(hr:min:sec)", $this->titleCol);
            }else{
                $legendWidth = ImageFontWidth(3) * strlen("Time(Seconds)");
                ImageString($this->image, 3, $this->width - 100+10, $this->height - 40+$legendHeight, "Time(hr:min:sec)", $this->titleCol);
            }   
        }   
        else{
            if(count($icon)<=4){
                $legendWidth = ImageFontWidth(3) * strlen("Time");
                ImageString($this->image, 3, $this->width - 100, $this->height - 45, "Time", $this->titleCol);
                $legendWidth = ImageFontWidth(3) * strlen("(Seconds)");
                ImageString($this->image, 3, $this->width - 100, $this->height - 40+$legendHeight, "(Seconds)", $this->titleCol);
            }else{
                $legendWidth = ImageFontWidth(3) * strlen("Time(Seconds)");
                ImageString($this->image, 3, $this->width - 100, $this->height - 40+$legendHeight, "Time(Seconds)", $this->titleCol);
            }   
        }   

3.

        if(!strcmp($period,"2"))
            $l->spit("png",$xtime*40.5,$yaxisNum,$ArrTitle,0,1,$resultDate);
        else
            $l->spit("png",$xtime,$yaxisNum,$ArrTitle);

        if(strlen($longtermtime)!=0)
            $cmd_longtime="-time ".$longtermtime;
        else
            $cmd_longtime="";

        if($controller!=2)
            $cmd_Long="/usr/sbin/daperf ".$conOp." -points ".PAGE_POINTS." ".$cmd_op." -longterm ".$cmd_longtime." -increment ".$increment." -noheader | awk -F \" \" 'NR>2 {print}'";
        else
            $cmd_Long="/usr/sbin/daperf ".$conOp." -points ".PAGE_POINTS." ".$cmd_op." -longterm ".$cmd_longtime." -increment ".$increment." -noheader | awk -F \" \" 'NR>3 {print}'";
        $cmd_checktime="/usr/sbin/daperf ".$conOp." -points ".PAGE_POINTS." ".$cmd_op." -longterm ".$cmd_longtime." -increment ".$increment." -noheader | awk -F \" \" ' NR==1 {print $6 \" \" $7\" \"$8\" \"$9\" \"$10}'";
        $value_checktime=explode("\n",`$cmd_checktime`);
        $checktime=$value_checktime[0];
4.
function decrease()
{
    document.location.href = "../System/performanceMonitoringPlot.php?type=<?= $type ?>&controller=<?= $controller ?>&vdType=<?= $vdType ?>&cache=<?= $cache ?>&DGname=<?= $DGname ?>&VDname=<?= $VDname ?>&time=<?= $time ?>&rwtype=<?= $rwtype ?>&period=<?= $period ?>&longtermtime=<?= $longtermtime ?>&increment=<?php if(!$decreasebutton) {echo $increment;} else {echo --$increment;} ?>";
}
function increase()
{
    document.location.href = "../System/performanceMonitoringPlot.php?type=<?= $type ?>&controller=<?= $controller ?>&vdType=<?= $vdType ?>&cache=<?= $cache ?>&DGname=<?= $DGname ?>&VDname=<?= $VDname ?>&time=<?= $time ?>&rwtype=<?= $rwtype ?>&period=<?= $period ?>&longtermtime=<?= $longtermtime ?>&increment=<?php if(!$increasebutton) {echo ++$increment;} else{echo $increment=$increment+2;} ?>";
}
function changeTime()
{
    var date = document.getElementById("longtermtime").value;
    var reg=/[^0-9,]*/g;
    var tmp=date.replace(reg,"");
    var year=tmp.substring(4,8);
    var month=tmp.substring(0,2);
    var day=tmp.substring(2,4);
    var hms=tmp.substring(8,14);
    var longtermtime=year+month+day+"_"+hms;
    if (longtermtime=="_")
      longtermtime="";
    document.location.href = "../System/performanceMonitoringPlot.php?type=<?= $type ?>&controller=<?= $controller ?>&vdType=<?= $vdType ?>&cache=<?= $cache ?>&DGname=<?= $DGname ?>&VDname=<?= $VDname ?>&time=<?= $time ?>&rwtype=<?= $rwtype ?>&period=<?= $period ?>&increment=0&longtermtime="+longtermtime+"&date="+date;
}

function refreshPage(num){
    var name="pic"+num;
    var number = Math.random();
    var obj=document.getElementById(name);
    var str=obj.src;
    var str2=str;
    if(str.indexOf("radd")!=-1){
        var i=str.lastIndexOf("&");
        str2=str.substring(0,i); 
    }
    obj.src = str2+"&radd="+number;
//  alert(obj.src);
}



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值