#!/bin/sh
tgfile=$1
rm -f $tgfile $tgfile-*
cat /proc/cpuinfo | sed '/^$/,$d' | grep 'model name\|cache size\|flags' >$tgfile

echo >>$tgfile

vers="2.9-vanilla	2.10.1-vanilla	2.11-vanilla	2.11-amd"
fns="strlen memcmp strcmp strncmp"
sizes="4 8 32 128"
for fn in $fns; do
  for sz in $sizes; do
    printf "%- 15s\n" $fn$sz >>$tgfile-names
  done
done

for ver in $vers; do
  for fn in $fns; do
    echo $ver-$fn
    glibc-$ver/ld-linux-x86-64.so.2 --library-path glibc-$ver ./strbench $fn 2048 $sizes |
    	cut -f 2 | cut -d ' ' -f 1 >>$tgfile-$ver
  done
done

echo "func,size	$vers" >>$tgfile
paste $(for ver in names $vers; do echo $tgfile-$ver; done) >>$tgfile
