Forum Discussion
Eduardo_Saito_1
Nimbostratus
Sep 25, 2007STATISTIC_BYTES_OUT with negative numbers.
Hello Everybody.
I'm having the following problem and I hope someone can help me.
I did a .net CSharp program that collects STATISTIC_BYTES_IN and STATISTIC_BYTES_OUT.
It really works when the value is low (lower than 10GB) but when this value is higher I'm getting negative values!
I've notice that the BIG-IP GUI shows interfaces statistics data in Bits not Bytes.
I'm logging these values to help me debug this issue:
(679703814 = 648MB <--- This one works)
9/25/2007 5:52 PM STATISTIC_BYTES_IN_LOW: 679703814 STATISTIC_BYTES_IN_HIGH: 0
(-1202998967 <--- Why this value is NEGATIVE? It should show aprox 7.3GB)
9/25/2007 5:59 PM STATISTIC_BYTES_OUT_LOW: -1202998967 STATISTIC_BYTES_OUT_HIGH: 1
Questions:
1) Why the second one shows a NEGATIVE number?
2) Why "STATISTIC_BYTES_OUT_HIGH" shows "1"? What's the difference between LOW and HIGH?
Thanks!
- Eduardo_Saito_1
Nimbostratus
Got it. - The statistics are returned in a structure with two 32bit signed values
struct ULong64 { long high; log low; }
- Gareth_104969
Nimbostratus
Hi All,function Convert-To64Bit() { param($high, $low) return ($high*[Math]:: Pow(2,32))+$low; }
- hwidjaja_37598
Altostratus
Try this out:[Convert]::ToUint64([Convert]::ToString($high,2).PadLeft(32,'0')+[Convert]::ToString($low,2).PadLeft(32,'0'),2)
- Thanks all! I'll make sure I use this in all my future tech tips...
- Glad you enjoy them! Let me know of any ideas you think would be useful for future tech tips and I'll see what I can do!
- Chris_W__13732
Nimbostratus
For the benefit of anyone working with python, here's how I conquered this problem... - Bernie_10630
Nimbostratus
I struggled with the same problem in Python, but I didn't have the ability ot use Jython. In the end used pack and unpack fromthe struct module.def hlconvert(high,low): if high<0: high = unpack('=I', pack('=i',high))[0] if low<0: low = unpack('=I', pack('=i',low))[0] return long((high<<32)|low)
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects