On Thu, May 20, 2010 at 12:16 PM, Jes Sorensen <jes.soren...@redhat.com> wrote:
> On 05/20/10 13:10, Avi Kivity wrote:
>> What's wrong with starting perf after the warm-up period and stopping it
>> before it's done?
>
> It's pretty hard to script.

I use the following.  It ain't pretty:

#!/bin/bash
cleanup() {
        trap - 2
        kill -2 $sleep_pid
        echo 0 >/sys/kernel/debug/tracing/events/kvm/enable
        kill $cat_pid
}

perf stat -a -e 'kvm:*' sleep 1h >results/perf_stat 2>&1 &
sleep_pid=$(sleep 1 && pgrep -x -f "sleep 1h")   # sleep 1 is to avoid
race with forked perf process
trap cleanup 2
echo 1 >/sys/kernel/debug/tracing/events/kvm/enable
cat /sys/kernel/debug/tracing/trace_pipe >results/trace &
cat_pid=$!

# ...do stuff here...

cleanup

Stefan
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to