From: Steven Rostedt Subject: Re: Perf trace event parse errors for KVM events Date: Sun, 30 May 2010 10:03:02 -0400 Message-ID: <1275228182.15884.1.camel@gandalf.stny.rr.com> References: <20100526123443.GB8905@stefan-thinkpad.transitives.com> <1275083157.22648.593.camel@gandalf.stny.rr.com> <4C00FF9B.9000107@redhat.com> <1275139177.22648.610.camel@gandalf.stny.rr.com> <4C021D7E.1060705@redhat.com> Reply-To: rostedt@goodmis.org Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: 7bit Cc: Stefan Hajnoczi , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Frederic Weisbecker , Marcelo Tosatti , Peter Zijlstra , Stefan Hajnoczi , Johannes Berg , Darren Hart To: Avi Kivity Return-path: Received: from hrndva-omtalb.mail.rr.com ([71.74.56.122]:56325 "EHLO hrndva-omtalb.mail.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754131Ab0E3ODH (ORCPT ); Sun, 30 May 2010 10:03:07 -0400 In-Reply-To: <4C021D7E.1060705@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Sun, 2010-05-30 at 11:10 +0300, Avi Kivity wrote: > On 05/29/2010 04:19 PM, Steven Rostedt wrote: > > > The pretty printing from the kernel handles this fine. But there's > > pressure to pass the format to userspace in binary and have the tool > > parse it. Currently it uses the print fmt to figure out how to parse. > > > > Using one of the examples that Stefan showed: > > > > kvmmmu/kvm_mmu_get_page: print fmt: "%s %s", ({ const char *ret = > > p->buffer + p->len; static const char *access_str[] = { "---", "--x", > > "w--", "w-x", "-u-", "-ux", "wu-", "wux" }; union kvm_mmu_page_role > > role; role.word = REC->role; trace_seq_printf(p, "sp gfn %llx %u%s q%u%s > > %s%s" " %snxe root %u %s%c", REC->gfn, role.level, role.cr4_pae ? " > > pae" : "", role.quadrant, role.direct ? " direct" : "", > > access_str[role.access], role.invalid ? " invalid" : "", role.nxe ? "" : > > "!", REC->root_count, REC->unsync ? "unsync" : "sync", 0); ret; }), > > REC->created ? "new" : "existing" > > > > > > You need a full C parser/interpreter to understand the above. > > > > Right. The tools can fall back to %x/%s based on the structure > descriptor if they can't parse the format string. > trace-cmd has plugin support to override how to read the format and print it out. It now has the ability to write those plugins in python. -- Steve