-
Notifications
You must be signed in to change notification settings - Fork 1
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
Handle different units in results. #28
base: master
Are you sure you want to change the base?
Conversation
convert_unit() | ||
{ | ||
unit=$1 | ||
base=1 | ||
|
||
if [[ $unit == "KiB/s" ]]; then | ||
base=1024 | ||
elif [[ $unit == "MiB/s" ]]; then | ||
base=`echo 1024*1024 |bc` | ||
elif [[ $unit == "GiB/s" ]]; then | ||
base=`echo 1024*1024*1024 |bc` | ||
elif [[ $unit == "sec" ]]; then | ||
base=`echo 1000*1000*1000 | bc` | ||
elif [[ $unit == "msec" ]]; then | ||
base=`echo 1000*1000 | bc` | ||
elif [[ $unit == "usec" ]]; then | ||
base=1000 | ||
elif [[ $unit == "nsec" ]]; then | ||
base=1 | ||
else | ||
echo unknown unit $unit | ||
exit 1 | ||
fi | ||
echo $base | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As stated in pyperf wrapper, why duplicate the unit conversion across multiple wrappers?
base=1024 | ||
elif [[ $unit == "MiB/s" ]]; then | ||
base=`echo 1024*1024 |bc` | ||
elif [[ $unit == "GiB/s" ]]; then | ||
base=`echo 1024*1024*1024 |bc` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe to make this more readable, you can express KiB/s as 2^10, MiB/s as 2^20, etc.
elif [[ $unit == "sec" ]]; then | ||
base=`echo 1000*1000*1000 | bc` | ||
elif [[ $unit == "msec" ]]; then | ||
base=`echo 1000*1000 | bc` | ||
elif [[ $unit == "usec" ]]; then | ||
base=1000 | ||
elif [[ $unit == "nsec" ]]; then | ||
base=1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar here for readability.
Handle different units in results
Output csv file with individual process results.