Commit d509d14
perf stat: Improve handling of termination by signal
When interrupting perf stat in repeat mode with a signal the signal is
passed to the child process but the repeat doesn't terminate:
```
$ perf stat -v --null --repeat 10 sleep 1
Control descriptor is not initialized
[ perf stat: executing run #1 ... ]
[ perf stat: executing run #2 ... ]
^Csleep: Interrupt
[ perf stat: executing run #3 ... ]
[ perf stat: executing run #4 ... ]
[ perf stat: executing run #5 ... ]
[ perf stat: executing run #6 ... ]
[ perf stat: executing run #7 ... ]
[ perf stat: executing run #8 ... ]
[ perf stat: executing run #9 ... ]
[ perf stat: executing run #10 ... ]
Performance counter stats for 'sleep 1' (10 runs):
0.9500 +- 0.0512 seconds time elapsed ( +- 5.39% )
0.01user 0.02system 0:09.53elapsed 0%CPU (0avgtext+0avgdata 18940maxresident)k
29944inputs+0outputs (0major+2629minor)pagefaults 0swaps
```
Terminate the repeated run and give a reasonable exit value:
```
$ perf stat -v --null --repeat 10 sleep 1
Control descriptor is not initialized
[ perf stat: executing run #1 ... ]
[ perf stat: executing run #2 ... ]
[ perf stat: executing run #3 ... ]
^Csleep: Interrupt
Performance counter stats for 'sleep 1' (10 runs):
0.680 +- 0.321 seconds time elapsed ( +- 47.16% )
Command exited with non-zero status 130
0.00user 0.01system 0:02.05elapsed 0%CPU (0avgtext+0avgdata 70688maxresident)k
0inputs+0outputs (0major+5002minor)pagefaults 0swaps
```
Note, this also changes the exit value for non-repeat runs when
interrupted by a signal.
Reported-by: Ingo Molnar <mingo@kernel.org>
Closes: https://lore.kernel.org/lkml/aS5wjmbAM9ka3M2g@gmail.com/
Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>1 parent 5123509 commit d509d14
1 file changed
+16
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1007 | 1007 | | |
1008 | 1008 | | |
1009 | 1009 | | |
1010 | | - | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
1011 | 1018 | | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
1012 | 1022 | | |
1013 | | - | |
| 1023 | + | |
1014 | 1024 | | |
1015 | 1025 | | |
1016 | 1026 | | |
| |||
1050 | 1060 | | |
1051 | 1061 | | |
1052 | 1062 | | |
1053 | | - | |
| 1063 | + | |
1054 | 1064 | | |
1055 | 1065 | | |
1056 | 1066 | | |
| |||
2969 | 2979 | | |
2970 | 2980 | | |
2971 | 2981 | | |
2972 | | - | |
| 2982 | + | |
2973 | 2983 | | |
2974 | 2984 | | |
2975 | 2985 | | |
| |||
3039 | 3049 | | |
3040 | 3050 | | |
3041 | 3051 | | |
3042 | | - | |
| 3052 | + | |
| 3053 | + | |
3043 | 3054 | | |
0 commit comments