perf bench messaging: Kill child processes when exit abnormally in process mode
When exit abnormally in process mode, customize SIGINT and SIGTERM signal
handler to kill the forked child processes.
Before:
# perf bench sched messaging -l
1000000 -g 1 &
[1] 8519
# # Running 'sched/messaging' benchmark:
# pgrep sched-messaging | wc -l
41
# kill -15 8519
[1]+ Terminated perf bench sched messaging -l
1000000 -g 1
# pgrep sched-messaging | wc -l
40
After:
# perf bench sched messaging -l
1000000 -g 1 &
[1] 8472
# # Running 'sched/messaging' benchmark:
# pgrep sched-messaging | wc -l
41
# kill -15 8472
[1]+ Exit 1 perf bench sched messaging -l
1000000 -g 1
# pgrep sched-messaging | wc -l
0
Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
Reviewed-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20230923093037.961232-5-yangjihong1@huawei.com
[ namhyung: fix a whitespace ]
Signed-off-by: Namhyung Kim <namhyung@kernel.org>