Messages in this thread | | | From | "Metzger, Markus T" <> | Date | Tue, 25 Nov 2008 11:23:09 +0000 | Subject | RE: [patch 9/9] x86, bts, ftrace: a BTS ftrace plug-in prototype |
| |
>-----Original Message----- >From: Frédéric Weisbecker [mailto:fweisbec@gmail.com] >Sent: Dienstag, 25. November 2008 11:40 >To: Metzger, Markus T
>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...
Thanks.
>> +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 :-)
I am using that field in struct trace_entry.
Without the assignment, though, I've seen funny cpu numbers. It seems that the field is not filled automatically.
regards, markus. --------------------------------------------------------------------- Intel GmbH Dornacher Strasse 1 85622 Feldkirchen/Muenchen Germany Sitz der Gesellschaft: Feldkirchen bei Muenchen Geschaeftsfuehrer: Douglas Lusk, Peter Gleissner, Hannes Schwaderer Registergericht: Muenchen HRB 47456 Ust.-IdNr. VAT Registration No.: DE129385895 Citibank Frankfurt (BLZ 502 109 00) 600119052
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
-- 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/
| |