<commit_before>#!/bin/bash

set -e -x

if [[ $EUID -ne 0 ]]; then
    echo "$0 must be run as root"
    exit 1
fi

debug=0
setup=0

while getopts ":ds" optopt; do
    case "${optopt}" in
        d)
            debug=1
            ;;
        s)
            setup=1
            ;;
        *)
            echo "invalid command line options"
            exit 1
            ;;
    esac
done

script_directory="$(dirname $(readlink -f ${BASH_SOURCE[0]}))"
source "${script_directory}/../sdn_sensor_rc"

export RTE_SDK="${HOME}/src/dpdk"
export RTE_TOOLS="${RTE_SDK}/tools"
export RTE_NIC_BIND="${RTE_TOOLS}/dpdk_nic_bind.py"

export PCI_ID_1="0000:01:00.0"
export PCI_ID_2="0000:01:00.1"

"${RTE_NIC_BIND}" --status | fgrep "${PCI_ID_1}"
"${RTE_NIC_BIND}" -b none          "${PCI_ID_1}"
"${RTE_NIC_BIND}" -b igb           "${PCI_ID_1}"
"${RTE_NIC_BIND}" --status | fgrep "${PCI_ID_1}"

"${RTE_NIC_BIND}" --status | fgrep "${PCI_ID_2}"
"${RTE_NIC_BIND}" -b none          "${PCI_ID_2}"
"${RTE_NIC_BIND}" -b igb_uio       "${PCI_ID_2}"
"${RTE_NIC_BIND}" --status | fgrep "${PCI_ID_2}"

modprobe igb || true
ip link set dev em1 up
ip addr add 192.168.2.6/24 dev em1 || true

if [[ $setup -gt 0 ]]; then
    echo "setup only, stopping"
    exit 0
fi

cd "${build_directory}"

export NN_PRINT_ERRORS=1
#export NN_PRINT_STATISTICS=1

if [[ $debug -gt 0 ]]; then
    gdb "${build_directory}/src/sdn_sensor"
else
    "${build_directory}/src/sdn_sensor"
fi<commit_msg>sdn_sensor.bash: remove some of the system-specific setup code<commit_after>#!/bin/bash

set -e -x

if [[ $EUID -ne 0 ]]; then
    echo "$0 must be run as root"
    exit 1
fi

debug=0

while getopts ":dv" optopt; do
    case "${optopt}" in
        d)
            debug=1
            ;;
        *)
            echo "invalid command line options"
            exit 1
            ;;
    esac
done

script_directory="$(dirname $(readlink -f ${BASH_SOURCE[0]}))"
source "${script_directory}/../sdn_sensor_rc"

cd "${build_directory}"

export NN_PRINT_ERRORS=1
#export NN_PRINT_STATISTICS=1

command_line="${build_directory}/src/sdn_sensor -c ${build_directory}/conf/sdn_sensor_vagrant.json"

if [[ $debug -gt 0 ]]; then
    gdb --args ${command_line}
else
    ${command_line}
fi

exit $?
{'fraction_non_alphanumeric': 0.15763546798029557, 'fraction_numerical': 0.028660994178235557, 'mean_word_length': 2.7993197278911564, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2451538', 'n_tokens_mistral': 908, 'n_tokens_neox': 866, 'n_words': 206}