Forum Discussion

Alok_3817's avatar
Alok_3817
Icon for Nimbostratus rankNimbostratus
May 10, 2010

Unit for the Stats pulled by using i Control

Hi, I am pulling the Global Stats using iControl for 9.4 I get the low and hight values and I create the 64 bit values.... but i am confused as what is the Unit of measurement Like STATISTIC_CLIENT_SIDE_BYTES_IN / STATISTIC_CLIENT_SIDE_BYTES_OUT Thats showing 9.5 G Bytes ... now is it per minute, per second, what ... cause it cannot be per second... i am pulling this off a 1500 with 1 Gb/s link in 1 ARM mode.... Is there a way to find out ? On an more un related note, is there a way to get absolute values from the graph data which is stored and can be pulled off the box... using iControl, the data i pull has some thing like 3.76767687e10
  • Alok, the stats returned in iControl are the counter values. In general, we don't retain rate based statistics but rely on the calling application to take the counters and convert them based on the polling interval. Take (stat2-stat1)/(seconds between polls) to get the rate/sec value.

     

     

    -Joe

     

  • I understand ... will try and incorporate that, also, I used the iControl Script in perl for the TMM CPU usage The script is below
    
    $Stats = SOAP::Lite
        -> uri('urn:iControl:System/Statistics')
        -> proxy("$sProtocol://$sHost:$sPort/iControl/iControlPortal.cgi");
    
    $soapresponse = $Stats->get_all_tmm_statistics();
    $TMMStatistics = $soapresponse->result;
    @TMMStatisticEntry = @{$TMMStatistics->{"statistics"}};
    for $i (0 .. scalar(@TMMStatisticEntry)-1)
    {
    $tmm = @TMMStatisticEntry[$i];
    @tmm_id[$i] = $tmm->{"tmm_id"};
    @StatisticArray = @{$tmm->{"statistics"}};
    foreach $stat (@StatisticArray)
    {
    $type = $stat->{"type"};
    if ($type eq "STATISTIC_MEMORY_USED_BYTES")
    {
    $value = $stat->{"value"};
    $low  = $value->{"low"};
    $high  = $value->{"high"};
    @usedmem[$i] = ($high<<32)|$low;
    }
    elsif ($type eq "STATISTIC_MEMORY_TOTAL_BYTES")
    {
    $value = $stat->{"value"};
    $low  = $value->{"low"};
    $high  = $value->{"high"};
    @totmem[$i] = ($high<<32)|$low;
    }
    elsif ($type eq "STATISTIC_TM_TOTAL_CYCLES")
    {
    $value = $stat->{"value"};
    $low  = $value->{"low"};
    $high  = $value->{"high"};
    @totalcycle_min[$i] = ($high<<32)|$low;
    }
    elsif ($type eq "STATISTIC_TM_IDLE_CYCLES")
    {
    $value = $stat->{"value"};
    $low  = $value->{"low"};
    $high  = $value->{"high"};
    @idlecycle_min[$i] = ($high<<32)|$low;
    }
    elsif ($type eq "STATISTIC_TM_SLEEP_CYCLES")
    {
    $value = $stat->{"value"};
    $low  = $value->{"low"};
    $high  = $value->{"high"};
    @sleepcycle_min[$i] = ($high<<32)|$low;
    }
    }
    }
    sleep 10;
    $soapresponse = $Stats->get_all_tmm_statistics();
    $TMMStatistics = $soapresponse->result;
    @TMMStatisticEntry = @{$TMMStatistics->{"statistics"}};
    for $i (0 .. scalar(@TMMStatisticEntry)-1)
    {
    $tmm = @TMMStatisticEntry[$i];
    $tmm_id = $tmm->{"tmm_id"};
    @StatisticArray = @{$tmm->{"statistics"}};
    foreach $stat (@StatisticArray)
    {
    $type = $stat->{"type"};
    if ($type eq "STATISTIC_TM_TOTAL_CYCLES")
    {
    $value = $stat->{"value"};
    $low  = $value->{"low"};
    $high  = $value->{"high"};
    @totalcycle_max[$i] = ($high<<32)|$low;
    }
    elsif ($type eq "STATISTIC_TM_IDLE_CYCLES")
    {
    $value = $stat->{"value"};
    $low  = $value->{"low"};
    $high  = $value->{"high"};
    @idlecycle_max[$i] = ($high<<32)|$low;
    }
    elsif ($type eq "STATISTIC_TM_SLEEP_CYCLES")
    {
    $value = $stat->{"value"};
    $low  = $value->{"low"};
    $high  = $value->{"high"};
    @sleepcycle_max[$i] = ($high<<32)|$low;
    }
    }
    }
    
    for $i (0 .. scalar(@TMMStatisticEntry)-1)
    {
    print "\nTMM ID\t\t\t: @tmm_id[$i]";
    print "\nUsed Memory\t\t: @usedmem[$i]";
    print "\nTotal Memory\t\t: @totmem[$i]";
    $deltaidle=("@idlecycle_max[$i]"-"@idlecycle_min[$i]");
    $deltatotal=("@totalcycle_max[$i]"-"@totalcycle_min[$i]");
    $deltasleep=("@sleepcycle_max[$i]"-"@sleepcycle_min[$i]");
    print "\n\n*** $deltaidle \t $deltatotal \t $deltasleep ***\n";
    $CPUPercent=((("$deltatotal"-("$deltaidle"+"$deltasleep"))/("$deltatotal"))*100);
    print "\nPercentage CPU\t\t: $CPUPercent %";
    }
    
    I have played around with the sleep values, but I am getting the output some times as 3 - 4 % (which is correct), but many a time the value is greater than 100%, some times even 300% , which is unbelievable ... is there some thing wrong I am doing ?
  • Hamish's avatar
    Hamish
    Icon for Cirrocumulus rankCirrocumulus
    Yes, your conversion from hi/low 32bit values to 64bit values isn't correct. Use

     

     

    my $quick64=($statValue->{high}*4294967296)+($statValue->{low}<0?(4294967296+$statValue->{low}):$statValue->{low});

     

     

     

    H
  • Hamish's avatar
    Hamish
    Icon for Cirrocumulus rankCirrocumulus
    Posted By Hamish on 05/13/2010 02:19 PM

     

    Yes, your conversion from hi/low 32bit values to 64bit values isn't correct. Use

     

     

    my $quick64=($statValue->{high}*4294967296)+($statValue->{low}<0?(4294967296+$statValue->{low}):$statValue->{low});

     

     

     

    I realised I could expand on that a bit and explain why the code isn't correct (Even though it does look fine, and you'd be quite right in expecting it to work).

     

     

    The real problem is not you code, it's your version of perl... Or more precisely what the compilation options were that have been specified for integers. The verison you're using has (I suspect) been compiled for 32 bit integers. As the << operation operates by default on unsigned ints (Unless 'use integer' is specified in which case it's signed), you actually get a bitwise left roll implemented... (Why a roll, I'm not sure sorry), which means when the value gets to 2^31, the next 'shift' will actually roll the high order bits back to the low order bits... The code

     

     

    
    !/usr/local/bin/perl -W
    my $OrigValue=1;
    for($i=0; $i<48; $i++) {
      my $finalValue=($OrigValue<<$i);
      print "$OrigValue << $i ==> $finalValue\n";
    }

     

     

    shows this... Giving the output

     

     

    
    bash-3.00 ./shift_check
    1 << 0 ==> 1
    1 << 1 ==> 2
    1 << 2 ==> 4
    ..[deleted]..
    1 << 29 ==> 536870912
    1 << 30 ==> 1073741824
    1 << 31 ==> 2147483648
    1 << 32 ==> 1
    1 << 33 ==> 2
    1 << 34 ==> 4
    1 << 35 ==> 8
    1 << 36 ==> 16
    1 << 37 ==> 32

     

     

    Wheras a version that provides 64 bit integers will work as intended... e.g.

     

     

    
    bash-3.00 ./shift_check
    1 << 0 ==> 1
    1 << 1 ==> 2
    1 << 2 ==> 4
    ..[deleted]..
    1 << 29 ==> 536870912
    1 << 30 ==> 1073741824
    1 << 31 ==> 2147483648
    1 << 32 ==> 4294967296
    1 << 33 ==> 8589934592
    1 << 34 ==> 17179869184
    1 << 35 ==> 34359738368
    1 << 36 ==> 68719476736
    1 << 37 ==> 137438953472

     

     

    Using the value 4294967296 and a multiply, overrides the left shift behaviour and should use floating point math (The perl default)... (Unless you specify 'use integer').

     

     

    To determine which waqy perl will go, IIRC you need to look at the compile time options... A version that will do 64bit integer math should have a compiletime option of USE_64_BIT_INT specified. A version that doesn't have this will most likely do 32bit (I think it's possible that some OS's will do 64bit anyway IIUC).

     

     

    e.g. from the two versions I have on an x64 Solaris box...

     

     

    
    bash-3.00 /usr/bin/perl -V|grep "Compile-time options:"
      Compile-time options: USE_64_BIT_INT USE_LARGE_FILES
    bash-3.00 /usr/local/bin/perl -V|grep "Compile-time options:"
      Compile-time options: PERL_MALLOC_WRAP USE_LARGE_FILES USE_PERLIO
    bash-3.00

     

     

    H