osx - dtrace OS X thread name -


i'm trying thread name in dtrace script on os x.

the script should record context switches of threads in application.

#!/usr/sbin/dtrace -s  #pragma d option quiet  begin {   printf("start dtrace script: time %ul\n\n", walltimestamp); }  proc:::exec-success / execname == "myapplication" /         {   trace(execname); }  sched:::off-cpu / execname == "myapplication" /         {   printf("tid: %ul (%s), off-cpu at: %ul\n", tid, curthread->td_name, walltimestamp);  }  sched:::on-cpu / execname == "myapplication" /         {   printf("tid: %ul, on-cpu at: %ul\n", tid, walltimestamp);  } 

but error:

dtrace: failed compile script dtrace_test.d: line 20: td_name not member of struct thread 

how can name of thread?

or analysis tried generated intermediate code dtrace script (with -s).

sudo dtrace -s ./dtrace_test.d 

but same error:

dtrace: failed compile script dtrace_test.d: line 20: td_name not member of struct thread 

i couldn't find name in thread struct here: http://www.opensource.apple.com/source/xnu/xnu-2050.9.2/osfmk/kern/thread.h

thx


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -