Linux software benchmarking

for the task, we need to compare our implementations with various optimizations and parameters. Is there a possible way to compare small programs on the linux command line (I know the time) with different parameters that give me time data like CSV or something similar? The result could be something like this:

Implementation      Time     
A                    23s
B with -O3 2Threads  15s 
B with -O3 4Threads  10s 

I'm pretty sure I saw something like this on some teacher slides, but I can't remember who or when it was ...

+3
source share
1 answer

Why not use the command timeinside the bashscript, something like:

#!/bin/bash

NPROG=`cat proglist | wc -l`
for i in `seq 1 ${NPROG}`
do
    PROG=`sed -n "${i}p" proglist`
    ARG=`sed -n "${i}p" arglist`
    TIME=`{ time ${PROG} ${ARG}; } 2>&1 | grep real | awk '{print $2}'`
    echo "${TIME} ${PROG} ${ARG}"
done

where proglistis a text file containing programs to execute

A
B
B

arglist - , , :

-a 1 -b 2
-f "foo"
-f "bar"

script :

 0m32.000s A -a 1 -b 2
 1m12.000s B -f "foo"
 5m38.000s B -f "bar"
+6

Source: https://habr.com/ru/post/1780255/


All Articles