summaryrefslogblamecommitdiffstats
path: root/split-locks
blob: b0a8bed6a8f481cf6082026077da8a9a69aade90 (plain) (tree)



































                                                                         
#!/bin/bash

SPLITTER=ft2csv

EVENTS="LOCK UNLOCK READ_LOCK READ_UNLOCK SYSCALL_IN SYSCALL_OUT"


OPTS="-r"
EXT=bin

function do_split() {
	printf "\n[$NUM/$TOTAL] Splitting $1\n"
	for E in $EVENTS; do
	    EP=${E/_/-}
	    WHERE=`basename "$1" | sed -e 's/.ft//' -e 's/_idx=[^_]*'// `
	    TARGET="${WHERE}_overhead=$EP.$EXT"
	    echo $1 $E ">>" $TARGET
	    $SPLITTER $OPTS $E "$1" >> $TARGET
	done
}

if [ ! -f "$1" ]; then
    echo  "Usage: split-locks <file.ft>+"
    exit 1
fi

TOTAL=$#
NUM=0


while [ "" != "$*" ]
do
    NUM=$((NUM + 1))
    do_split "$1"
    shift
done