Skip to content

Commit 1668c72

Browse files
tomcucinottardementi
authored andcommitted
pcm-bw-histogram.sh: expect pcm-memory to reside in same folder, rather than ./
As pcm-bw-histogram.sh is installed (renamed to pcm-bw-histogram) alongside the pcm-memory binary in sbin/, `pcm-memory` should be found in the same folder as the script, rather than the current folder. Without this patch, pcm-bw-histogram cannot be launched (as it cannot find ./pcm-memory), unless you cd to the sbin/ folder. This is inconvenient, as the script creates a temporary file, as well as an output .csv file, in the current folder. With this patch, you can just launch pcm-bw-histogram from any folder, and it will find pcm-memory in the same folder where it's been installed.
1 parent 4661471 commit 1668c72

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/pcm-bw-histogram.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@ if [ "$#" -ne 1 ]; then
1111
exit 1
1212
fi
1313

14+
mydir=$(dirname "$0")
15+
1416
out=bw-tmp
1517

1618
rm $out
1719

1820
echo
1921
echo ========= CHECKING FOR PMM SUPPORT =========
2022
echo
21-
./pcm-memory -pmm -- sleep 1 >tmp 2>&1
23+
"$mydir/pcm-memory" -pmm -- sleep 1 >tmp 2>&1
2224
dram_only=`cat tmp | grep "PMM traffic metrics are not available" | wc -l`
2325
rm tmp
2426
if [ $dram_only -gt 0 ]
@@ -35,9 +37,9 @@ echo
3537

3638
if [ $dram_only -gt 0 ]
3739
then
38-
chrt --rr 1 nice --adjustment=-20 ./pcm-memory 0.005 -nc -csv=$out -- sleep $1
40+
chrt --rr 1 nice --adjustment=-20 "$mydir/pcm-memory" 0.005 -nc -csv=$out -- sleep $1
3941
else
40-
chrt --rr 1 nice --adjustment=-20 ./pcm-memory 0.005 -pmm -nc -csv=$out -- sleep $1
42+
chrt --rr 1 nice --adjustment=-20 "$mydir/pcm-memory" 0.005 -pmm -nc -csv=$out -- sleep $1
4143
fi
4244

4345
cat $out | sed 's/;/,/g' > $out.csv

0 commit comments

Comments
 (0)