Re: how to detect thread switches

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks very much. I will give it a try.

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

Since I am not sure the way Linux works on your embedded platform,
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


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux