Re: [dtrace-discuss] howto measure CPU load

2008-04-01 Thread Adam Leventhal
On Mar 30, 2008, at 3:17 PM, Sean McGrath - Sun Microsystems Ireland  
wrote:
>  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
>
> < >  > 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):

It's even easier than that, because Apple included much (all?) of  
Brendan's
DTrace Toolkit in Mac OS X. The amazing thing? It's already in your  
path:

$ cd /usr/bin
$ grep 'Brendan Gregg' * | wc -l
   94

This includes /usr/bin/iotop. Brendan, if you don't write that damned  
blog
post about this, I will!

Adam

--
Adam Leventhal, Fishworkshttp://blogs.sun.com/ahl

___
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org


Re: [dtrace-discuss] howto measure CPU load

2008-03-31 Thread Sylvain Quartier
Hello all DTrace gurus,
In my company we are developing a system in order to collect, store,
aggregate and produce graphs based on DTrace probes results. The idea is
to access remotely to any DTrace system capable, remotely, to discover
then push DTrace scripts automatically and get results to store and
graph them.
We did it with Solaris 10, and today we access remotely to DTrace using
the Common Agent Containers (code name CACAO).
Is anyone know if this type of agent are also implemented in OS X,
FreeBSD or any other OS that are DTrace capable?
thanks


Sylvain QUARTIER
email: [EMAIL PROTECTED]

___
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org


Re: [dtrace-discuss] howto measure CPU load

2008-03-30 Thread Travis Crawford
Sean, thanks for the pointer. This was actually super helpful because
in the Apple dtrace tarball there's a port of the dtrace toolkit;
these examples are going to answer a lot of questions.



On Mon, Mar 31, 2008 at 12:17 AM, Sean McGrath - Sun Microsystems
Ireland <[EMAIL PROTECTED]> wrote:
> 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  0002dbb9 _avenrun
>  < >  kilroy>
>  < >
>  < >  Of course, without the source, it's not clear what the variable type 
> is
>  < >
>  < >  Soyour 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
>  < >  > dtrace-discuss@opensolaris.org
>  < >  >
>  < >
>  < ___
>  < dtrace-discuss mailing list
>  < dtrace-discuss@opensolaris.org
>
>  --
>  Sean.
>  .
>
___
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org


Re: [dtrace-discuss] howto measure CPU load

2008-03-30 Thread Sean McGrath - Sun Microsystems Ireland
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  0002dbb9 _avenrun
< >  kilroy>
< >
< >  Of course, without the source, it's not clear what the variable type is
< >
< >  Soyour 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
< >  > dtrace-discuss@opensolaris.org
< >  >
< >
< ___
< dtrace-discuss mailing list
< dtrace-discuss@opensolaris.org

-- 
Sean.
.
___
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org


Re: [dtrace-discuss] howto measure CPU load

2008-03-30 Thread Travis Crawford
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.

--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  0002dbb9 _avenrun
>  kilroy>
>
>  Of course, without the source, it's not clear what the variable type is
>
>  Soyour 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
>  > dtrace-discuss@opensolaris.org
>  >
>
___
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org


Re: [dtrace-discuss] howto measure CPU load

2008-03-30 Thread Jim Mauro
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  0002dbb9 _avenrun
kilroy>

Of course, without the source, it's not clear what the variable type is

Soyour 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
> dtrace-discuss@opensolaris.org
>   
___
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org


Re: [dtrace-discuss] howto measure CPU load

2008-03-30 Thread Menno Lageman
Travis Crawford wrote:

> 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?

The ` (backtick) is used to access to access kernel variables in DTrace 
scripts. The best way to find what these do is to use the OpenGrok 
source browser at http://src.opensolaris.org.

The hp_avenrun variable is defined here: 
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/os/clock.c#97

Menno
-- 
Menno Lageman - Sun Microsystems - http://blogs.sun.com/menno
___
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org


[dtrace-discuss] howto measure CPU load

2008-03-30 Thread Travis Crawford
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
dtrace-discuss@opensolaris.org