Reputation: 20140
In Linux 2.6.32-32, is there a way to find the following information about a thread programmatically in a pthreads
program? I need: run count, stack pointer, stack start/end, stack size, stack usage. Something like ThreadX, I guess, but within a program. Thanks.
Upvotes: 4
Views: 4200
Reputation: 231451
As an addendum to BjoernD's answer, you can obtain context switch counts and total run time using the getrusage
call with RUSAGE_THREAD
. You cannot obtain information on the raw number of time slices executed; this information is not tracked in the first place.
Upvotes: 4
Reputation: 4780
For obtaining your own stack pointer you can always do something along the lines of:
mword sp;
asm volatile ("mov %esp, $0" : "=r"(sp));
Upvotes: 6