Forum Discussion

Richard__Harlan's avatar
Richard__Harlan
Historic F5 Account
May 23, 2006

get_memory_usage_information

I have a script that is trying to get the memory used on the boxed. I am useing get_memory_usage_information I can get total memroy with out a problem just haveing a problem getting used_memory. From the SDK it looks like I can ask for used_memory just like total_memory but all I get back is zero. Any ideas? Thanks

3 Replies

  • Hunter, can you post your code where you are having a problem. What are the values of the low and high compontents of the UInt64 structure returned?

     

     

    -Joe
  • I'd be careful about dropping the high 32 bits of those values. For memory it's probably OK as long as you don't have more than 4GB. A safer approach would be to build a native 64 bit value from the low and high components of our UInt64 structure.

    
    my $total_memory = &build64($memory_info->{"total_memory"});
    ----------------------------------------------------------------------------
     build64
    ----------------------------------------------------------------------------
    sub build64()
    {
    ($UInt64) = (@_);
    $low = $UInt64->{"low"};
    $high = $UInt64->{"high"};
     For some reason this doesn't work...
    $value64 = Math::BigInt->new($high)->blsft(32)->bxor($low);
    $value64 = Math::BigInt->new(Math::BigInt->new($high)->blsft(32))->bxor($low);
    return $value64;
    }

    I guess that's assuming you don't have 64bit support builtin (which isn't the default) and you have the Math::BigInt module on your system.

    -Joe
  • Richard__Harlan's avatar
    Richard__Harlan
    Historic F5 Account
    One last question is the get_memory_usage_information used memory the total memory used in the box, or just what is used by the TMM? Thanks