-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added(utils): netdev-pci-speed shows used/max throughput of NIC's PCI…
… slot Output in megabits only. Example: $ netdev-pci-speed eth1 eth1 1000/126400
- Loading branch information
1 parent
d76d712
commit 9de1809
Showing
2 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ def read(*paths): | |
|
||
setuptools.setup( | ||
name='netutils-linux', | ||
version='2.7.5', | ||
version='2.7.6', | ||
author='Oleg Strizhechenko', | ||
author_email='[email protected]', | ||
license='MIT', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
|
||
device=$1 | ||
bus_addr="$(ethtool -i $device | grep bus | awk '{print $2}')" | ||
dev_speed="$(ethtool eth1 | grep Speed | egrep -o [0-9]+)" | ||
pci_type="$(dmidecode --type slot | grep -B6 0000:af:00.0 | egrep -m1 -o 'PCI Express [0-9] x[0-9]+')" | ||
read _ _ version x <<< "$pci_type" | ||
if [ "$version" = '1' ]; then | ||
[ "$x" = 'x1' ] && slot_speed=250 | ||
[ "$x" = 'x2' ] && slot_speed=500 | ||
[ "$x" = 'x4' ] && slot_speed=1000 | ||
[ "$x" = 'x8' ] && slot_speed=2000 | ||
[ "$x" = 'x16' ] && slot_speed=4000 | ||
elif [ "$version" = '2' ]; then | ||
[ "$x" = 'x1' ] && slot_speed=500 | ||
[ "$x" = 'x2' ] && slot_speed=1000 | ||
[ "$x" = 'x4' ] && slot_speed=2000 | ||
[ "$x" = 'x8' ] && slot_speed=4000 | ||
[ "$x" = 'x16' ] && slot_speed=8000 | ||
elif [ "$version" = '3' ]; then | ||
[ "$x" = 'x1' ] && slot_speed=984 | ||
[ "$x" = 'x2' ] && slot_speed=1970 | ||
[ "$x" = 'x4' ] && slot_speed=3940 | ||
[ "$x" = 'x8' ] && slot_speed=7880 | ||
[ "$x" = 'x16' ] && slot_speed=15800 | ||
elif [ "$version" = '4' ]; then | ||
[ "$x" = 'x1' ] && slot_speed=1969 | ||
[ "$x" = 'x2' ] && slot_speed=3940 | ||
[ "$x" = 'x4' ] && slot_speed=7880 | ||
[ "$x" = 'x8' ] && slot_speed=15750 | ||
[ "$x" = 'x16' ] && slot_speed=31500 | ||
fi | ||
echo $device $dev_speed/$((slot_speed*8)) |