Skip to content
Snippets Groups Projects
Commit fb105ffe authored by Christian Thomsen's avatar Christian Thomsen
Browse files

added hardware_performance_counter.sh to implement part B:

perf stat -e "PMU1,PMU2, ...≪program name>
parent 7b04128c
No related branches found
No related tags found
1 merge request!1added hardware_performance_counter.sh to implement part B:
Showing with 9511 additions and 0 deletions
#!/bin/bash
PROGRAMM="./build/src/fileReader"
BLOCKGROESSEN=(1024 16384 65536)
PMUs="cache-references,cache-misses,mem_access,page-faults"
ERGEBNISDATEI="perf_results.txt"
echo "Blockgröße | Cache-Zugriffe | Cache-Misses | Speicherzugriffe | Seitenfehler" > $ERGEBNISDATEI
for BLOCK in "${BLOCKGROESSEN[@]}"; do
echo "Teste Blockgröße: $BLOCK Bytes"
# Starte `perf stat` und leite die Ausgabe um
perf stat -e $PMUs $PROGRAMM $BLOCK > /dev/null 2> perf_output.txt
# Extrahiere die Messwerte aus der `perf_output.txt`
CACHE_REF=$(grep "cache-references" perf_output.txt | awk '{print $1}')
CACHE_MISS=$(grep "cache-misses" perf_output.txt | awk '{print $1}')
MEM_ACCESS=$(grep "mem_access" perf_output.txt | awk '{print $1}')
PAGE_FAULTS=$(grep "page-faults" perf_output.txt | awk '{print $1}')
# Speichere die Werte in der Datei
echo "$BLOCK | $CACHE_REF | $CACHE_MISS | $MEM_ACCESS | $PAGE_FAULTS" >> $ERGEBNISDATEI
done
echo "Messungen abgeschlossen. Ergebnisse in $ERGEBNISDATEI gespeichert."
File added
Usage: ./build/src/fileReader <filename> <block_size>
Example: ./build/src/fileReader largefile.txt 4096
Performance counter stats for './build/src/fileReader 65536':
2794260 cache-references
34039 cache-misses # 1.22% of all cache refs
2796744 mem_access
109 page-faults
0.007317616 seconds time elapsed
0.001824000 seconds user
0.005472000 seconds sys
Blockgröße | Cache-Zugriffe | Cache-Misses | Speicherzugriffe | Seitenfehler
1024 | 2827351 | 34361 | 2829874 | 108
16384 | 2798755 | 32813 | 2801242 | 108
65536 | 2794260 | 34039 | 2796744 | 109
Performance Measurements
------------------------
Average execution time for size => 1 : 450 ms
Average execution time for size => 2 : 235 ms
Average execution time for size => 4 : 127 ms
Average execution time for size => 8 : 77 ms
Average execution time for size => 16 : 54 ms
Average execution time for size => 32 : 42 ms
Average execution time for size => 64 : 35 ms
Average execution time for size => 128 : 32 ms
Average execution time for size => 256 : 31 ms
Average execution time for size => 512 : 30 ms
Average execution time for size => 1024 : 30 ms
Average execution time for size => 2048 : 30 ms
Average execution time for size => 4096 : 29 ms
Average execution time for size => 8192 : 26 ms
Average execution time for size => 16384 : 24 ms
Average execution time for size => 32768 : 23 ms
Average execution time for size => 65536 : 22 ms
Average execution time for size => 131072 : 23 ms
Average execution time for size => 262144 : 22 ms
Average execution time for size => 524288 : 23 ms
Average execution time for size => 1048576 : 26 ms
Average execution time for size => 2097152 : 27 ms
Average execution time for size => 4194304 : 31 ms
Average execution time for size => 8388608 : 35 ms
Average execution time for size => 16777216 : 36 ms
Average execution time for size => 33554432 : 35 ms
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Performance Measurements
------------------------
Average execution time for size => 1 : 1953 ms
Average execution time for size => 2 : 1962 ms
Average execution time for size => 4 : 1953 ms
Average execution time for size => 8 : 2014 ms
Average execution time for size => 16 : 1932 ms
Average execution time for size => 32 : 1993 ms
Average execution time for size => 64 : 2120 ms
Average execution time for size => 128 : 2613 ms
Average execution time for size => 256 : 2261 ms
Average execution time for size => 512 : 1942 ms
Average execution time for size => 1024 : 1931 ms
Average execution time for size => 2048 : 1901 ms
Average execution time for size => 4096 : 1933 ms
Average execution time for size => 8192 : 1966 ms
Average execution time for size => 16384 : 1849 ms
Average execution time for size => 32768 : 1910 ms
Average execution time for size => 65536 : 1988 ms
Average execution time for size => 131072 : 1889 ms
Average execution time for size => 262144 : 1949 ms
Average execution time for size => 524288 : 2126 ms
Average execution time for size => 1048576 : 1945 ms
Average execution time for size => 2097152 : 1832 ms
Average execution time for size => 4194304 : 1870 ms
Average execution time for size => 8388608 : 1904 ms
Average execution time for size => 16777216 : 1915 ms
Average execution time for size => 33554432 : 1905 ms
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment