#!/bin/bash

NTHREADS=$1
shift
echo "Running $NTHREADS"

mkdir -p out
rm -v out/*
for ((i=0; i<$NTHREADS; i++))
do
	# echo "httperf --client $i/$NTHREADS $@ > out/result.$i.out"
	httperf --client $i/$NTHREADS $@ > out/result.$i.out &
done

wait
echo "Experiment terminated"

FILES=""
for ((i=0; i<$NTHREADS; i++))
do
	FILES="$FILES out/result.$i.out"
done
./parse-httperf.py $FILES ||  echo $FILES