mirror of
https://github.com/brendangregg/perf-tools.git
synced 2025-12-01 07:26:04 +07:00
Merge pull request #26 from yangoliver/master
bitesize: work with different versions of awk and bash
This commit is contained in:
@@ -85,8 +85,11 @@ sectors=(${buckets[*]})
|
||||
((max_i = ${#buckets[*]} - 1))
|
||||
while (( i <= max_i )); do
|
||||
(( sectors[$i] = ${sectors[$i]} * 1024 / $secsz ))
|
||||
if (( i && ${sectors[$i]} <= ${sectors[$i - 1]} )); then
|
||||
die "ERROR: bucket list must increase in size."
|
||||
# avoid negative array index errors for old version bash
|
||||
if (( i > 0 ));then
|
||||
if (( ${sectors[$i]} <= ${sectors[$i - 1]} )); then
|
||||
die "ERROR: bucket list must increase in size."
|
||||
fi
|
||||
fi
|
||||
(( i++ ))
|
||||
done
|
||||
@@ -136,7 +139,8 @@ echo
|
||||
echo "$stat" | awk -v tpoint=$tpoint -v max_i=$max_i -v most=$most '
|
||||
function star(sval, smax, swidth) {
|
||||
stars = ""
|
||||
if (smax == 0) return ""
|
||||
# using int could avoid error on gawk
|
||||
if (int(smax) == 0) return ""
|
||||
for (si = 0; si < (swidth * sval / smax); si++) {
|
||||
stars = stars "#"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user