My system is a N:1 platform running 2.4 kernel.
I find very few options/tools/libraries on the net regarding process profiling. This brings me to think of how profiling is done on embedded systems (or they never do?)
regards,
On Tue, Aug 17, 2010 at 11:22 PM, Mulyadi Santosa <mulyadi.santosa@xxxxxxxxx> wrote:
On Wed, Aug 18, 2010 at 00:16, Ashwath <itsmeash@xxxxxxxxx> wrote:Since I am not sure the way Linux works on your embedded platform,
> Hi All,
>
> I am writing a profiler for an embedded application running on linux and I
> need to detect thread context switches.
> Threading is done using pThread library
perhaps you need to find it out first: is your platform use N:1 thread
approach? 1:1? Or M:N (very unlikely, but who knows?)
Assuming 1:1, like our current NPTL does in normal (non embedded ) IBM
PC x86 compatible, thread switch is basically a schedule() too. Thus,
put a hook in schedule in kernel space, that should do it.
If N:1, then it must be the master thread that does the switch. Try to
strace your application (the master thread) and try to figure out the
time this thread does something can be indicated as "switching". Quite
likely it is done using ptrace.
Then, you might need to hook ptrace ( harder) or find a function that
call it and hook it there (perhaps easier).
--
regards,
Mulyadi Santosa
Freelance Linux trainer and consultant
blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com