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

Handle different units in results. #28

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dvalinrh
Copy link
Contributor

@dvalinrh dvalinrh commented Nov 7, 2024

Handle different units in results
Output csv file with individual process results.

@dvalinrh dvalinrh requested a review from a team November 7, 2024 20:04
Comment on lines +259 to +283
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
}
Copy link
Member

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?

Comment on lines +265 to +269
base=1024
elif [[ $unit == "MiB/s" ]]; then
base=`echo 1024*1024 |bc`
elif [[ $unit == "GiB/s" ]]; then
base=`echo 1024*1024*1024 |bc`
Copy link
Member

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.

Comment on lines +270 to +277
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
Copy link
Member

Choose a reason for hiding this comment

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

Similar here for readability.

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