Re: [PATCH][RFC] oprofile for 2.5.39

Andi Kleen (ak@suse.de)
Sun, 29 Sep 2002 05:08:07 +0200


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