[CRIU] [PATCH] [RFC] perf: Here is an example how to trace syscalls
Andrew Vagin
avagin at parallels.com
Fri Oct 3 08:22:25 PDT 2014
On Fri, Oct 03, 2014 at 07:18:53PM +0400, Pavel Emelyanov wrote:
> On 09/30/2014 04:05 PM, Andrey Vagin wrote:
> > perf doesn't affect performance so significant as strace and
> > it allows to trace parasite code.
> >
> > All processes are executed in a new perf_evets cgroup and
> > "perf record" collects events only for processes from this group.
>
> Presumably I need to do some preparations:
>
> Execute zdtm/live/static/env00
> ./env00 --pidfile=env00.pid --outfile=env00.out --envname=ENV_00_TEST
> Dump 22781
> no access to cgroup /sys/fs/cgroup/perf_event/test
Could you mount the perf_event cgroup?
[avagin at localhost ~]$ cat /proc/self/mountinfo | grep perf
31 21 0:28 / /sys/fs/cgroup/perf_event rw,nosuid,nodev,noexec,relatime
shared:17 - cgroup cgroup rw,perf_event
>
> usage: perf record [<options>] [<command>]
> or: perf record [<options>] -- <command> [<options>]
>
> -G, --cgroup <name> monitor event in cgroup name only
> Use the following command to analize perf data:
> perf trace report -i /root/src/criu/test/dump/static/env00/22781/1/perf.dump
> WARNING: env00 returned 129 and left running for debug needs
> Test: zdtm/live/static/env00, Result: FAIL
>
>
> > Signed-off-by: Andrey Vagin <avagin at openvz.org>
> > ---
> > test/zdtm.sh | 11 ++++++++++-
> > 1 file changed, 10 insertions(+), 1 deletion(-)
> >
> > diff --git a/test/zdtm.sh b/test/zdtm.sh
> > index b5133c3..1eba6d7 100755
> > --- a/test/zdtm.sh
> > +++ b/test/zdtm.sh
> > @@ -1,5 +1,8 @@
> > #!/bin/bash
> >
> > +test -d /sys/fs/cgroup/perf_event/zdtm || mkdir /sys/fs/cgroup/perf_event/zdtm || exit 1
> > +echo $$ > /sys/fs/cgroup/perf_event/zdtm/tasks
> > +
> > ARCH=`uname -m | sed \
> > -e s/i.86/i386/ \
> > -e s/sun4u/sparc64/ \
> > @@ -582,8 +585,14 @@ EOF
> >
> > save_fds $PID $ddump/dump.fd
> > save_maps $PID $ddump/dump.maps
> > - setsid $CRIU_CPT $dump_cmd -D $ddump -o dump.log -v4 -t $PID $gen_args $cpt_args
> > + echo $$ > /sys/fs/cgroup/perf_event/tasks
> > + perf record -o $ddump/perf.dump -e raw_syscalls:sys_exit,raw_syscalls:sys_enter --cgroup test,test -a bash <<EOF
> > +echo 0 > /sys/fs/cgroup/perf_event/zdtm/tasks &&
> > +$CRIU_CPT $dump_cmd -D $ddump -o dump.log -v4 -t $PID $gen_args $cpt_args
> > +EOF
> > retcode=$?
> > + echo Use the following command to analize perf data:
> > + echo perf trace report -i $ddump/perf.dump
> >
> > #
> > # Here we may have two cases: either checkpoint is failed
> >
>
More information about the CRIU
mailing list