38 lines · bash
1#!/bin/bash2# SPDX-License-Identifier: GPL-2.0+3#4# Start up the specified number of jitter.sh scripts in the background.5#6# Usage: . jitterstart.sh n jittering-dir duration [ sleepmax [ spinmax ] ]7#8# n: Number of jitter.sh scripts to start up.9# jittering-dir: Directory in which to put "jittering" file.10# duration: Time to run in seconds.11# sleepmax: Maximum microseconds to sleep, defaults to one second.12# spinmax: Maximum microseconds to spin, defaults to one millisecond.13#14# Copyright (C) 2021 Facebook, Inc.15#16# Authors: Paul E. McKenney <paulmck@kernel.org>17 18jitter_n=$119if test -z "$jitter_n"20then21 echo jitterstart.sh: Missing count of jitter.sh scripts to start.22 exit 3323fi24jittering_dir=$225if test -z "$jittering_dir"26then27 echo jitterstart.sh: Missing directory in which to place jittering file.28 exit 3429fi30shift31shift32 33touch ${jittering_dir}/jittering34for ((jitter_i = 1; jitter_i <= $jitter_n; jitter_i++))35do36 jitter.sh $jitter_i "${jittering_dir}/jittering" "$@" &37done38