#!/bin/bash
#Compare l'operation d'ajout en fin de liste sur les ArrayList / LinkedList / Tableaux standards

TESTS=3
STRUCT=3
NBOPERATIONS="100000 125000 150000 175000 200000 225000 250000 275000 300000"
echo "NbOperations,Version,CPU,Mem"

for nb in $NBOPERATIONS
do
    for i in `seq $STRUCT`
    do 
        for j in `seq $TESTS`
        do 
                if [ $i = 1 ]
                then
                        res=`(/usr/bin/time -f "%U,%M" java p4a.MainArrayListStdAddFin $nb > /dev/null) 2>&1`
                        echo "$nb,ArrayListStd,$res"
                elif [ $i = 2 ]
                then
                        res=`(/usr/bin/time -f "%U,%M" java p4a.MainLinkedListStdAddFin $nb > /dev/null) 2>&1`
                        echo "$nb,LinkedListStd,$res"
                else
                        res=`(/usr/bin/time -f "%U,%M" java p4a.MainTableauStdAdd $nb > /dev/null) 2>&1`
                        echo "$nb,TableauStd,$res"
                fi
                done
        done
done