jitterstart.sh 994 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/bash
  2. # 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. jitter_n=$1
  18. if test -z "$jitter_n"
  19. then
  20. echo jitterstart.sh: Missing count of jitter.sh scripts to start.
  21. exit 33
  22. fi
  23. jittering_dir=$2
  24. if test -z "$jittering_dir"
  25. then
  26. echo jitterstart.sh: Missing directory in which to place jittering file.
  27. exit 34
  28. fi
  29. shift
  30. shift
  31. touch ${jittering_dir}/jittering
  32. for ((jitter_i = 1; jitter_i <= $jitter_n; jitter_i++))
  33. do
  34. jitter.sh $jitter_i "${jittering_dir}/jittering" "$@" &
  35. done