DTraceToolkit has a dtrace script (Proc/pidpersec.d) that refers to a variable mpid as below profile:::tick-1sec { printf("%-22Y %8d %6d\n", walltimestamp, `mpid, pids); pids = 0; } Where is `mpid getting picked from (it isn''t declared anywhere else)? What does the character ` in `mpid signify? I do not see any reference to this variable in the dtrace manual/user-guide. -Shiv
Hi Shiv,> DTraceToolkit has a dtrace script (Proc/pidpersec.d) that refers to a > variable mpid as below > > profile:::tick-1sec > { > printf("%-22Y %8d %6d\n", walltimestamp, `mpid, pids); > pids = 0; > } > > Where is `mpid getting picked from (it isn''t declared anywhere else)?The backquote (`) allows you to access variables in the running kernel. The ''mpid'' variable is defined in usr/src/uts/common/os/pid.c (on Solaris that is). For more information on the scoping operator check out the docs: http://wikis.sun.com/display/DTrace/Variables#Variables-ExternalVariables Jon.
>DTraceToolkit has a dtrace script (Proc/pidpersec.d) that refers to a >variable mpid as below > >profile:::tick-1sec >{ > printf("%-22Y %8d %6d\n", walltimestamp, `mpid, pids); > pids = 0; >} > >Where is `mpid getting picked from (it isn''t declared anywhere else)? >What does the character ` in `mpid signify? >I do not see any reference to this variable in the dtrace manual/user-guide. >I think `mpid means "global for the kernel". "mpid" is the variable which contains the last created pid. Casper
Shiv, S h i v wrote:> DTraceToolkit has a dtrace script (Proc/pidpersec.d) that refers to a > variable mpid as below > > profile:::tick-1sec > { > printf("%-22Y %8d %6d\n", walltimestamp, `mpid, pids); > pids = 0; > } > > Where is `mpid getting picked from (it isn''t declared anywhere else)? > What does the character ` in `mpid signify? >mpid is a kernel variable which (I think) indicates the last pid created on that box. So, `mpid refers to that kernel variable. That (`) is the way to refer to a kernel variable. - Sanjeev.> I do not see any reference to this variable in the dtrace manual/user-guide. > > -Shiv > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org >
On Sat, Nov 8, 2008 at 5:18 PM, Jon Haslam <Jonathan.Haslam at sun.com> wrote:> Hi Shiv, > >> DTraceToolkit has a dtrace script (Proc/pidpersec.d) that refers to a >> variable mpid as below >> >> profile:::tick-1sec >> { >> printf("%-22Y %8d %6d\n", walltimestamp, `mpid, pids); >> pids = 0; >> } >> >> Where is `mpid getting picked from (it isn''t declared anywhere else)? > > The backquote (`) allows you to access variables in the running kernel. The > ''mpid'' variable is defined in usr/src/uts/common/os/pid.c (on Solaris > that is). For more information on the scoping operator check out the docs: > > http://wikis.sun.com/display/DTrace/Variables#Variables-ExternalVariables >Thanks to all for the responses. It is now clear. -Shiv