Re: [PATCH][RFC] oprofile for 2.5.39

From: Andi Kleen (ak@suse.de)
Date: Sat Sep 28 2002 - 22:08:07 EST


>
> Basically it's a matter of :
>
> task_struct *
> EIP/Event
> EIP/Event
> EIP/Event
> EIP/Event
> ....

I think you can easily do that by keeping state per cpu in the
NMI handler.

        if (current == __get_cpu_var(oprofile_cpustate)) {
                /* log current */
                __get_cpu_var(oprofile_cpustate) = current;
        } else {
                /* do nothing */
        }
        /* log EIP */

[or when you are an module use an cache line padded array indexed with
smp_processor_id - per cpu data doesn't work from modules]

This is even more efficient because when the NMI rate is lower than
the task switch frequency (which is not unlikely) then you'll avoid
many useless task_struct loggings.

-Andi
        
-
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/



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