Travis Crawford stated:
< Thanks Menno and Jim! I'm looking around the Apple documentation to
< hopefully find where they store the load average. Yes, it would be
< nice to have all the source available; I should take a better look at
< opensolaris.

  Why not browse the Apple port of The DTraceToolkit itself ?

 It uses averunnable.ldavg instead of the Solaris specific hp_avenrun.
  Found from having a look at the OS-X port of DTrace at: 
    http://www.opensource.apple.com/darwinsource

Regards,
Sean.
.
< 
< --travis
< 
< 
< On Mon, Mar 31, 2008 at 12:02 AM, Jim Mauro <[EMAIL PROTECTED]> wrote:
< > Hi Travis - Your first clue here is the backtick operator (`) used to
< >  extract hp_avenrun[0]. The backtick operator is used to read the
< >  value of kernel variables, which will be specific to the running kernel.
< >  That is, Solaris, Mac OS X (Darwin), FreeBSD and all other kernels
< >  with DTrace will not have portability when it comes to dtrace scripts
< >  that use the backtick variable, since by definition they will be kernel
< >  specific.
< >
< >  hp_avenrun[] is a Solaris kernel variable:
< >
< > 
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/os/clock.c#97
< >
< >  For some kernel variables (like avenrun), you could look around for
< >  something
< >  similar in your target kernel:
< >
< >  kilroy> nm -x /mach_kernel | grep avenrun
< >  004d25ac 0f 08 0000 0002dbb9 _avenrun
< >  kilroy>
< >
< >  Of course, without the source, it's not clear what the variable type is....
< >
< >  So....your example below is specific to Solaris. If you see the backtick
< >  operator, think "kernel specific".
< >
< >  HTH,
< >  /jim
< >
< >
< >
< >  Travis Crawford wrote:
< >  > Hi dtrace-discuss,
< >  >
< >  > Having recently upgraded to OS X 10.5 I'm relatively new to DTrace, so
< >  > apologies if this has been covered before; I did search the archives
< >  > and didn't find anything though.
< >  >
< >  > As a DTrace starter project I'd like to understand how to extract
< >  > common performance metrics before diving too far in. One of these
< >  > common metrics is load average, which I thought would be pretty easy.
< >  > However, I'm confused by this code snippet (from
< >  > http://www.brendangregg.com/DTrace/iotop):
< >  >
< >  > """
< >  > /* fetch 1 min load average */
< >  > this->load1a  = `hp_avenrun[0] / 65536;
< >  > this->load1b  = ((`hp_avenrun[0] % 65536) * 100) / 65536;
< >  > """
< >  >
< >  > I can't figure out where hp_avenrun is defined. I searched
< >  > http://wikis.sun.com/display/DTrace as well as looking at all the
< >  > probes on my system ($ sudo dtrace -l | grep hp_avenrun) and came up
< >  > empty.
< >  >
< >  > So my question is, when reading d scripts, how should I go about
< >  > finding out what these mysterious variables are?
< >  >
< >  > Thanks,
< >  > Travis
< >  > _______________________________________________
< >  > dtrace-discuss mailing list
< >  > [email protected]
< >  >
< >
< _______________________________________________
< dtrace-discuss mailing list
< [email protected]

-- 
Sean.
.
_______________________________________________
dtrace-discuss mailing list
[email protected]

Reply via email to