Brian Lu
2006-Apr-04 16:28 UTC
[dtrace-discuss] How to get newly created thread id in dtrace
Hi, experts, I want to use dtrace to print a newly created thread id (created by pthread_create) in my dtrace script. I.e. when pthread_create returns, the script will print the newly created thread id. According to the pthread_create manual, the thread id is stored in the first argument. Does anyone know how to access the first argument in pthread_create:return? Thanks Brian
Bryan Cantrill
2006-Apr-04 16:35 UTC
[dtrace-discuss] How to get newly created thread id in dtrace
On Wed, Apr 05, 2006 at 12:28:29AM +0800, Brian Lu wrote:> Hi, experts, > > I want to use dtrace to print a newly created thread id (created by > pthread_create) in my dtrace script. I.e. when pthread_create returns, > the script will print the newly created thread id. > According to the pthread_create manual, the thread id is stored in the > first argument.I would use the proc provider and its "lwp-create" probe instead: # dtrace -n proc:::lwp-create''{printf("%s created thread %d...\n", \ execname, args[0]->pr_lwpid)}'' -q inetd created thread 1... in.telnetd created thread 1... in.telnetd created thread 1... in.telnetd created thread 1... nscd created thread 9882... nscd created thread 9883... nscd created thread 9884... ksh created thread 1... ksh created thread 1... ksh created thread 1... nscd created thread 9885... nscd created thread 9886... See the proc provider chapter in the documentation for more details. - Bryan -------------------------------------------------------------------------- Bryan Cantrill, Solaris Kernel Development. http://blogs.sun.com/bmc