Threads and userland profliing...

John Baldwin jhb at FreeBSD.org
Tue May 11 14:32:58 PDT 2004


Currently in the pstats structure we have a uprof substructure that holds 
various values used for userland processing.  Does anyone know what parts of 
that structure are supposed to be per-process and which are supposed to be 
per-thread?  pr_addr and pr_ticks seem to be definite per-thread items, but 
the other values I'm not sure of.

Specifically, is the userland table that pr_base, pr_size, pr_off, and 
pr_scale refer to per-thread or is it supposed to be shared among all threads 
in a process?  If it's shared, do we need to be using casuptr() or something 
similar in addupc_intr() instead of a separate fetch and store?  
addupc_task() also has a race window between the copyin() and copyout() as 
well if it is shared.  If its private, then I suppose each thread has to call 
profil(2) and gprof is supposed to be smart enough to make that happen?  Does 
POSIX have anything to say regarding threads and profil(2)?

I'm trying to lock this small structure and I'd like to know if all of uprof 
should be per-thread or just pr_addr and pr_ticks.

P.S. Please cc me on replies as I am not subscribed.

-- 
John Baldwin <jhb at FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org


More information about the freebsd-threads mailing list