diff options
author | Namhyung Kim <namhyung@kernel.org> | 2014-05-12 09:47:24 +0900 |
---|---|---|
committer | Jiri Olsa <jolsa@kernel.org> | 2014-05-12 11:09:49 +0200 |
commit | 4560471053a9eb1586d0091066016a5cbcef4b6b (patch) | |
tree | 100dc35716a3790abf4b5d6cb4b4be6f959c51c5 /tools/virtio/linux/vringh.h | |
parent | 6bcab4e1eaa1f669d003051ef3b87a963d8763bb (diff) | |
download | linux-4560471053a9eb1586d0091066016a5cbcef4b6b.tar.gz linux-4560471053a9eb1586d0091066016a5cbcef4b6b.tar.bz2 linux-4560471053a9eb1586d0091066016a5cbcef4b6b.zip |
perf record: Propagate exit status of a command line workload
Currently perf record doesn't propagate the exit status of a workload
given by the command line. But sometimes it'd useful if it's
propagated so that a monitoring script can handle errors
appropriately.
To do that, it moves most of logic out of the exit handlers and run
them directly in the __cmd_record(). The only thing needs to be done
in the handler is propagating terminating signal so that the shell can
terminate its loop properly when Ctrl-C was pressed. Also it cleaned
up the resource management code in record__exit().
With this change, perf record returns the child exit status in case of
normal termination and send signal to itself when terminated by signal.
Example run of Stephane's case:
$ perf record true && echo yes || echo no
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.013 MB perf.data (~589 samples) ]
yes
$ perf record false && echo yes || echo no
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.013 MB perf.data (~589 samples) ]
no
Jiri's case (error in parent):
$ perf record -m 10G true && echo yes || echo no
rounding mmap pages size to 17179869184 bytes (4194304 pages)
failed to mmap with 12 (Cannot allocate memory)
no
$ ulimit -n 6
$ perf record sleep 1 && echo yes || echo no
failed to create 'go' pipe: Too many open files
Couldn't run the workload!
no
And Peter's case (interrupted by signal):
$ while :; do perf record sleep 1; done
^C[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.014 MB perf.data (~593 samples) ]
Reported-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Stephane Eranian <eranian@google.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Ingo Molnar <mingo@kernel.org>
Link: http://lkml.kernel.org/r/1399855645-25815-1-git-send-email-namhyung@kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Diffstat (limited to 'tools/virtio/linux/vringh.h')
0 files changed, 0 insertions, 0 deletions