diff --git a/tools/import-trace/CMakeLists.txt b/tools/import-trace/CMakeLists.txt index b8a04e49..9e9d3a30 100644 --- a/tools/import-trace/CMakeLists.txt +++ b/tools/import-trace/CMakeLists.txt @@ -42,3 +42,4 @@ if (BUILD_LLVM_DISASSEMBLER) endif (BUILD_LLVM_DISASSEMBLER) install(TARGETS import-trace RUNTIME DESTINATION bin) +install(PROGRAMS import-symbols.sh DESTINATION bin) diff --git a/tools/import-trace/import-symbols.sh b/tools/import-trace/import-symbols.sh new file mode 100755 index 00000000..6fb80f59 --- /dev/null +++ b/tools/import-trace/import-symbols.sh @@ -0,0 +1,68 @@ +#!/bin/bash +# TODO: make this part of import-trace +set -e + +# handle command line arguments +if [ ! $# -eq 4 ]; then + echo "usage: $0 DATABASE VARIANT BENCHMARK ELF" >&2 + exit 1 +fi + +DATABASE=$1 +VARIANT=$2 +BENCHMARK=$3 +ELF=$4 +TABLE=symbol +MYSQL="mysql -B --quick $DATABASE" + + +# check if ELF exists +if [ ! -e $ELF ]; then + echo "$ELF not found" >&2 + exit 1 +fi +echo "importing $VARIANT/$BENCHMARK symbols from $ELF ..." + + +# get fail*'s variant_id +ID=$(echo "SELECT id FROM variant WHERE variant='$VARIANT' AND benchmark='$BENCHMARK'" | $MYSQL -N) +if [ -z $ID ]; then + echo "no such variant/benchmark!" >&2 + exit 1 +fi + + +# generate huge SQL statement and execute +$MYSQL <