Re: [ltt-dev] Re: [PATCH] LTT for 2.5.38 1/9: Core infrastructure

From: Ingo Molnar (
Date: Sun Sep 22 2002 - 18:32:30 EST

this is that a trace point should do, at most:

task_t *tracer_task;

int curr_idx[NR_CPUS];
int curr_pending[NR_CPUS];

struct trace_event **trace_ring;

void trace(event, data1, data2, data3)
        int cpu = smp_processor_id();
        int idx, pending, *curr = curr_idx + cpu;
        struct trace_event *t;
        unsigned long flags;

        if (!event_wanted(current, event, data1, data2, data3))


        idx = ++curr_idx[cpu] & (NR_TRACE_ENTRIES - 1);
        pending = ++curr_pending[cpu];

        t = trace_ring[cpu] + idx;

        t->event = event;
        t->data1 = data1;
        t->data2 = data2;
        t->data3 = data3;

        if (curr_pending == TRACE_LOW_WATERMARK && tracer_task)


this should cover most of what's needed. The event_wanted() filter
function should be made as fast as possible. Note that the irq-disabled
section is not strictly needed but nice and also makes it work on the
preemptible kernel. (It's not a big issue at all to run these few
instructions with irqs disabled.)

[there are also other details like putting curr_index and curr_pending
into the per-cpu area and similar stuff.]


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

This archive was generated by hypermail 2b29 : Mon Sep 23 2002 - 22:00:37 EST