Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753201AbYKYKjp (ORCPT ); Tue, 25 Nov 2008 05:39:45 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752509AbYKYKjh (ORCPT ); Tue, 25 Nov 2008 05:39:37 -0500 Received: from qw-out-2122.google.com ([74.125.92.25]:14293 "EHLO qw-out-2122.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752500AbYKYKjg (ORCPT ); Tue, 25 Nov 2008 05:39:36 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=LljDQoFOpCN6Qf0U7efTgEPD0cO92Qg8QeBKo7yle47dfKfUY4cNCuE2I32ZYPzP9b GMIHDMXtlO5JxzT7PdvYx241AU5+vo9GJ75fNA5RdSAd30MVewUbcurwk3O5uQxIJWIZ pfoHGN/GkIUm2eoy9eB/gLLdRjj3gs2fQnWSA= Message-ID: Date: Tue, 25 Nov 2008 11:39:35 +0100 From: "=?ISO-8859-1?Q?Fr=E9d=E9ric_Weisbecker?=" To: "Markus Metzger" Subject: Re: [patch 9/9] x86, bts, ftrace: a BTS ftrace plug-in prototype Cc: hpa@zytor.com, linux-kernel@vger.kernel.org, mingo@elte.hu, tglx@linutronix.de, markus.t.metzger@gmail.com, roland@redhat.com, akpm@linux-foundation.org, mtk.manpages@gmail.com, eranian@googlemail.com, juan.villacis@intel.com, "Andi Kleen" In-Reply-To: <20081125092415.A31432@sedona.ch.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20081125092415.A31432@sedona.ch.intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1718 Lines: 49 Hi Markus, 2008/11/25 Markus Metzger : > +static enum print_line_t bts_trace_print_line(struct trace_iterator *iter) > +{ > + struct trace_entry *entry = iter->ent; > + struct trace_seq *seq = &iter->seq; > + struct bts_entry *it; > + > + trace_assign_type(it, entry); > + > + if (entry->type == TRACE_BTS) { > + int ret; > +#ifdef CONFIG_KALLSYMS > + char function[KSYM_SYMBOL_LEN]; > + sprint_symbol(function, it->from); > +#else > + char *function = ""; > +#endif > + > + ret = trace_seq_printf(seq, "%4d 0x%lx -> 0x%lx [%s]\n", > + entry->cpu, it->from, it->to, function); You can use seq_print_ip_sym() which handles the ifdef and the sprint_symbol... > +void trace_bts(struct trace_array *tr, unsigned long from, unsigned long to) > +{ > + struct ring_buffer_event *event; > + struct bts_entry *entry; > + unsigned long irq; > + > + event = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry), &irq); > + if (!event) > + return; > + entry = ring_buffer_event_data(event); > + tracing_generic_entry_update(&entry->ent, 0, from); > + entry->ent.type = TRACE_BTS; > + entry->ent.cpu = smp_processor_id(); If you look at the struct trace_entry, you will see find the cpu field. It is already inserted automatically :-) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/