On Fri, Aug 27, 2010 at 04:44:31PM -0700, Rafael Vanoni wrote:
> I was trying to aggregate on the stack trace of a CPU's current
> thread from a cpu_t * and the best I could do was aggregating with
> sym() on the t_startpc field of the CPU's current thread.
> 
> It doesn't look like it would be very difficult to write a new
> action to get stack() from a given CPU id. Would that be of interest
> to anyone else? If so, please let me know and I'll write it up.

It is extremely difficult to do that from another CPU on SPARC, since
register windows mean that much of the stack state is kept in-CPU.  Even
on x86, you can't get anything better than the last place the thread updated
its t_pcb (e.g. in cv_wait()), and there's a good chance the stack won't line
up.

Why do you need this?  Could a global variable + a fast profile interrupt get
you close enough:

event-of-interest
{
        interesting[blah->cpu->cpu_thread] = 1;
}

profile:::profile-4999, sched:::on-cpu, sched:::off-cpu
/interesting[curthread]/
{
        interesting[curthread] = 0;
        @a[probename, stack()] = count();
}

Cheers,
- jonathan
_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org

Reply via email to