#!/bin/bash # SPDX-License-Identifier: GPL-2.0 # Author: Ravi Bangoria if [ "$EUID" -ne 0 ]; then echo "Please run as root" exit fi sudo insmod tinypmu-k.ko cleanup() { for i in "$@"; do echo -n "${i} " kill ${i} done wait rmmod tinypmu_k rm -rf /dev/tinypmu_register rm -rf /dev/tinypmu_unregister echo "" exit } bash _tinypmu-u-register.sh & reg_pid=$! bash _tinypmu-u-unregister.sh & unreg_pid=$! # register Ctrl+C cleanup if aborted inbetween #trap "cleanup '${reg_pid}' '${unreg_pid}' ${event_pids[@]}" 2 echo ${reg_pid} ${unreg_pid} sleep 10 cleanup ${reg_pid} ${unreg_pid}