From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=53326 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OnIOL-0007Gs-R2 for qemu-devel@nongnu.org; Sun, 22 Aug 2010 17:50:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OnIOE-0007uT-Ri for qemu-devel@nongnu.org; Sun, 22 Aug 2010 17:47:44 -0400 Received: from mail-gx0-f173.google.com ([209.85.161.173]:37200) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OnIOE-0007uJ-Od for qemu-devel@nongnu.org; Sun, 22 Aug 2010 17:47:42 -0400 Received: by gxk5 with SMTP id 5so2067283gxk.4 for ; Sun, 22 Aug 2010 14:47:42 -0700 (PDT) Message-ID: <4C719AFD.8050006@codemonkey.ws> Date: Sun, 22 Aug 2010 16:47:41 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 00/14] trace: Add static tracing to QEMU References: <1281609395-17621-1-git-send-email-stefanha@linux.vnet.ibm.com> In-Reply-To: <1281609395-17621-1-git-send-email-stefanha@linux.vnet.ibm.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Julien Desfossez , qemu-devel@nongnu.org, Prerna Saxena On 08/12/2010 05:36 AM, Stefan Hajnoczi wrote: > This patch series adds static tracing to QEMU. It can be used to instrument > QEMU code by means of lightweight logging called trace events. > > Prerna and I are now posting the entire patch series with a serious eye towards > checking we meet users' and developers' tracing needs and with the goal of > getting this functionality merged into qemu.git. > > Tracing infrastructure allows debugging, performance analysis, and observation > to be performed. Right now there are ad-hoc logging calls in some source files > which require rebuilding QEMU with certain #defines and perform poorly. This > patch series introduces a single tracing infrastructure which is easy to use > and can replace ad-hoc techniques. > > Two key points: > > 1. The trace-events file contains the set of defined trace events which can be > called from a source file. For example, trace-events has: > > qemu_malloc(size_t size, void *ptr) "size %zu ptr %p" > > and qemu-malloc.c uses this trace event like this: > > #include "trace.h" /* needed for trace event prototype */ > > void *qemu_malloc(size_t size) > { > void *ptr; > if (!size&& !allow_zero_malloc()) { > abort(); > } > ptr = oom_check(malloc(size ? size : 1)); > trace_qemu_malloc(size, ptr); /*<-- trace event */ > return ptr; > } > > 2. The built-in 'simple' trace backend writes binary traces to > /tmp/trace-. They can be pretty-printed like this: > > ./simpletrace.py trace-events /tmp/trace-* > > Although you can also try LTTng Userspace Tracer ('ust' trace backend), the > 'simple' trace backend provides commands within the QEMU monitor to > enable/disable trace events at runtime. It is easy to use and should serve > as a good default trace backend. > > The 'simple' trace backend's limitation is that it isn't thread-safe and can > therefore only trace correctly when the QEMU global mutex is held. > > For full documentation, see: > http://repo.or.cz/w/qemu/stefanha.git/blob_plain/8d9f8f62d5af986fab6636770450f57fbd0d8b66:/docs/tracing.txt > > The git branch is here: > http://repo.or.cz/w/qemu/stefanha.git/shortlog/refs/heads/tracing > This turned out very nice. Good work! Regards, Anthony Liguori > Stefan > > > >