The perf command is used as a primary interface to the Linux kernel performance monitoring capabilities and can record CPU performance counters and trace points.
perf [--version] [--help] [OPTIONS] COMMAND [ARGS]
perf --help
help command will give you more insight into perf tools.
Steps to get the values of perf events :-
step 1 : create a file filename.sh
step 2 : paste the code given below and edit the file name each time.(filename is c program filename)
clang filename.c -o filename
sudo perf stat -e power/energy-pkg/,uncore_imc/data_reads/,uncore_imc/data_writes/ ./filename
sudo perf stat -e branches,branch-misses,branch-loads,branch-load-misses,cache-misses,cpu-cycles,instructions,context-switches,fp_arith_inst_retired.scalar_single,LLC-stores,LLC-loads ./filename
sudo perf stat -e LLC-store-misses,LLC-load-misses,L1-dcache-stores,L1-dcache-loads ./filename
sudo perf stat -e L1-dcache-load-misses,L1-icache-load-misses ./filename
step 3 : save the .sh file to the same location where c program is saved. Give executable permission to .sh file.
step 4 : configure the c program file and get the input file for the programs.
step 5 : run the .sh file.
Result will looks something like this :
create file filename.sh and write the following code inside it and save it accordingly and run inside the folder with the programs.
- Selected algorithms.
- BFS
- Quick Sort
- Fibonacci series
- Tower of Hanoi
- Fractional Knapsack
- Bubble Sort
- Selection Sort
- Insertion Sort
- Merge Sort
- Bucket Sort
- Radix sort
- Benchmark
- coremark
- Dhrystone
- dhrystone
- dhrystone-reg
- linpack
- linpackdp
- linpacksp
- tripforce
- tripfind
Benchmark program source : https://github.com/nfinit/ansibench
For benchmark program go through the readme file in ansibench.
APPLICATIONS | INPUT SIZE |
---|---|
BFS | 30000 |
Quick Sort | 500000 |
Fibonacci series | 50 |
Tower of Hanoi | 35 |
Fractional Knapsack | 1000000 |
Bubble Sort | 100000 |
Selection Sort | 500000 |
Insertion Sort | 500000 |
Merge Sort | 500000 |
Bucket Sort | 100000 |
Radix sort | 500000 |
coremark | 2000000 |
dhrystone | 1410065408 |
dhrystone-reg | 1410065408 |
linpackdp | 3000 |
linpacksp | 3000 |
tripfind | NA |
input files are in input folder.
Generated dataset link : https://docs.google.com/spreadsheets/d/1TPHpm2SB1pnXAvvm9By__Ly6OQd9IzUZ/edit?rtpof=true#gid=527532308