From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35394) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W3gNT-00039T-Ro for qemu-devel@nongnu.org; Thu, 16 Jan 2014 01:24:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W3gNO-0005Fg-UW for qemu-devel@nongnu.org; Thu, 16 Jan 2014 01:24:31 -0500 Received: from mail-pa0-x236.google.com ([2607:f8b0:400e:c03::236]:45260) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W3gNO-0005FQ-Mj for qemu-devel@nongnu.org; Thu, 16 Jan 2014 01:24:26 -0500 Received: by mail-pa0-f54.google.com with SMTP id fa1so2247509pad.27 for ; Wed, 15 Jan 2014 22:24:25 -0800 (PST) Date: Thu, 16 Jan 2014 14:24:20 +0800 From: Stefan Hajnoczi Message-ID: <20140116062420.GA14680@stefanha-thinkpad> References: <1389756247-9425-1-git-send-email-stefanha@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1389756247-9425-1-git-send-email-stefanha@redhat.com> Subject: Re: [Qemu-devel] [PATCH] trace: fix simple trace "disable" keyword List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: qemu-devel@nongnu.org On Wed, Jan 15, 2014 at 11:24:07AM +0800, Stefan Hajnoczi wrote: > The trace-events "disable" keyword turns an event into a nop at > compile-time. This is important for high-frequency events that can > impact performance. > > The "disable" keyword is currently broken in the simple trace backend. > This patch fixes the problem as follows: > > Trace events are identified by their TraceEventID number. When events > are disabled there are two options for assigning TraceEventID numbers: > 1. Skip disabled events and don't assign them a number. > 2. Assign numbers for all events regardless of the disabled keyword. > > The simple trace backend and its binary file format uses approach #1. > > The tracetool infrastructure has been using approach #2 for a while. > > The result is that the numbers used in simple trace files do not > correspond with TraceEventIDs. In trace/simple.c we assumed that they > are identical and therefore emitted bogus numbers. > > This patch fixes the bug by using TraceEventID for trace_event_id() > while sticking to approach #1 for simple trace file numbers. This > preserves simple trace file format compatibility. > > Signed-off-by: Stefan Hajnoczi > --- > scripts/tracetool/backend/simple.py | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) Applied to my tracing tree: https://github.com/stefanha/qemu/commits/tracing I applied this fairly quickly, so feel free to speak up if you have any code review feedback. I can still drop it from the tracing queue before sending the next pull request. Stefan