mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Frédéric Weisbecker" <fweisbec@gmail.com>
To: "Markus Metzger" <markus.t.metzger@intel.com>
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" <andi@firstfloor.org>
Subject: Re: [patch 9/9] x86, bts, ftrace: a BTS ftrace plug-in prototype
Date: Tue, 25 Nov 2008 11:39:35 +0100	[thread overview]
Message-ID: <c62985530811250239v4a51cd1p4de5f1616a41ef36@mail.gmail.com> (raw)
In-Reply-To: <20081125092415.A31432@sedona.ch.intel.com>

Hi Markus,

2008/11/25 Markus Metzger <markus.t.metzger@intel.com>:
> +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 = "<unknown>";
> +#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 :-)

  parent reply	other threads:[~2008-11-25 10:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-25  8:24 Markus Metzger
2008-11-25 10:12 ` Andi Kleen
2008-11-25 10:25   ` Metzger, Markus T
2008-11-25 10:39 ` Frédéric Weisbecker [this message]
2008-11-25 11:23   ` Metzger, Markus T
2008-11-25 11:30     ` Frédéric Weisbecker
2008-11-25 16:33 ` Ingo Molnar
2008-11-25 16:40 ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c62985530811250239v4a51cd1p4de5f1616a41ef36@mail.gmail.com \
    --to=fweisbec@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=eranian@googlemail.com \
    --cc=hpa@zytor.com \
    --cc=juan.villacis@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markus.t.metzger@gmail.com \
    --cc=markus.t.metzger@intel.com \
    --cc=mingo@elte.hu \
    --cc=mtk.manpages@gmail.com \
    --cc=roland@redhat.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®