Re: [PATCH] tracing, perf : add cpu hotplug trace events
From: Steven Rostedt
Date: Fri Jan 07 2011 - 10:52:17 EST
On Fri, 2011-01-07 at 14:51 +0530, Amit Kucheria wrote:
> > +
> > +TRACE_EVENT(hotplug_start,
> > +
> > + TP_PROTO(unsigned int type, unsigned int step, unsigned int cpuid),
> > +
> > + TP_ARGS(type, step, cpuid),
> > +
> > + TP_STRUCT__entry(
> > + __field(u32, type)
> > + __field(u32, step)
> > + __field(u32, cpuid)
> > + ),
> > +
> > + TP_fast_assign(
> > + __entry->type = type;
> > + __entry->step = step;
> > + __entry->cpuid = cpuid;
> > + ),
> > +
> > + TP_printk("type=%lu step=%lu cpuid=%lu", (unsigned long)__entry->type,
> > + (unsigned long)__entry->step, (unsigned long)__entry->cpuid)
> > +);
> > +
> > +TRACE_EVENT(hotplug_end,
> > +
> > + TP_PROTO(unsigned int type, unsigned int step, unsigned int cpuid),
> > +
> > + TP_ARGS(type, step, cpuid),
> > +
> > + TP_STRUCT__entry(
> > + __field(u32, type)
> > + __field(u32, step)
> > + __field(u32, cpuid)
> > + ),
> > +
> > + TP_fast_assign(
> > + __entry->type = type;
> > + __entry->step = step;
> > + __entry->cpuid = cpuid;
> > + ),
> > +
> > + TP_printk("type=%lu step=%lu cpuid=%lu", (unsigned long)__entry->type,
> > + (unsigned long)__entry->step, (unsigned long)__entry->cpuid)
> > +);
> > +
> >
Please use classes when having tracepoints that have the same fields.
This will save a bit of kernel memory. Something like:
DECLARE_EVENT_CLASS(hotplug_template,
TP_PROTO(unsigned int type, unsigned int step, unsigned int cpuid),
TP_ARGS(type, step, cpuid),
TP_STRUCT__entry(
__field(u32, type)
__field(u32, step)
__field(u32, cpuid)
),
TP_fast_assign(
__entry->type = type;
__entry->step = step;
__entry->cpuid = cpuid;
),
TP_printk("type=%lu step=%lu cpuid=%lu", (unsigned long)__entry->type,
(unsigned long)__entry->step, (unsigned long)__entry->cpuid)
);
DEFINE_EVENT(hotplug_template, hotplug_start,
TP_PROTO(unsigned int type, unsigned int step, unsigned int cpuid),
TP_ARGS(type, step, cpuid);
DEFINE_EVENT(hotplug_template, hotplug_end,
TP_PROTO(unsigned int type, unsigned int step, unsigned int cpuid),
TP_ARGS(type, step, cpuid);
-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/