This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Tracking the Program Counter


Dear all,
I am new to System Tap, but I have found it quite useful. I am trying
to debug a performance issue. I need to monitor the context switches
of a process in an embedded system running Linux kernel 2.6.32.29. I
have used the scheduler probe example from the systemtap website,to
monitor the context switch of the process. The question I have is the
following:
When I hit the context switch probe, I want to know the program
counter (or instruction pointer) of the task that is getting switched
out.
probe scheduler.ctxswitch
{
// Here, is it possible to get the PC of the
//prev_task .
//  I am trying the following piece of code:
if(prevtsk_state ==1 || prevtsk_state ==2) {
            printf(" @");
        }
        else {
            printf(" #");
        }
        ua=uaddr();
        printf("UPC: %X (%s)",ua, usymdata(ua))
        printf("BT: %s ", ubacktrace());  // attempting to print backtrace

}

I do get an output that shows the task was in certain library code
such as select() or mutex calls.
The questions I have are:
(1) Is this the valid way of obtaining information about switched out task?
(2) How does systemtap know that the uaddr() is for the task that has
been switched out and perhaps not for the stap call itself?

Would really appreciate any help/inputs/suggestions on this.

Thanks and Regards


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]