Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed porstat rate and util issues. #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rajkumar38
Copy link

- What I did
Fixed "portstat" rate and utilization issue.
Changed size factor from 1024 to 1000 for rate throughput calculation.

- How I did it
Pls check the diff.

- How to verify it
"portstat" "portstat -a"

- Previous command output (if the output of a command-line utility has changed)
IFACE STATE RX_OK RX_BPS RX_UTIL RX_ERR RX_DRP RX_OVR TX_OK TX_BPS TX_UTIL TX_ERR TX_DRP TX_OVR


Ethernet41 U 353,628,250 98.67 MB/s 1.93% 0 0 0 353,660,334 98.67 MB/s 1.93% 0 0 0

- New command output (if the output of a command-line utility has changed)

IFACE STATE RX_OK RX_BPS RX_UTIL RX_ERR RX_DRP RX_OVR TX_OK TX_BPS TX_UTIL TX_ERR TX_DRP TX_OVR


Ethernet2 U 5,065,263,485 124.98 MB/s 99.99% 0 0 0 113 7.63 B/s 0.00% 0 0 0

@rajkumar38
Copy link
Author

@antony-rheneus @banagiri @radha-danda
Pls review.

rate = "{:.2f}".format(rate/1024/1024)+' MB'
elif rate > 1024*10:
rate = "{:.2f}".format(rate/1024)+' KB'
if rate > 1000*1000*10:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should not be 1000.
1024 is the correct value.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For throughput calculation against the link speed, factor has to be 1000 and not 1024.
https://my.ciena.com/CienaPortal/s/question/0D50z00005JK3dQCAT/ethernet-packet-rate-and-throughput-calculations

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the reference mentions to convert Link speed in 1000's instead of 1024.
Here we are converting frame size, not the speed

util = rate/(port_rate*1024*1024*1024/8.0)*100
return "{:.2f}%".format(util)
util = rate/(port_rate*1000*1000*1000/8.0)*100
if util < 100:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think this is right way

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any suggestion, If we don't round-off, value sometimes looks like 100.05%. This is because of time delta is not accurate.

Copy link
Contributor

@antony-rheneus antony-rheneus Sep 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you update 1024, itw ould not be more than 100%

Even with 1024, if it is more than 100%, then the overhead crosses the link speed itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants