Author: gnn
Date: Thu Jun 13 18:47:53 2013
New Revision: 251697
URL: http://svnweb.freebsd.org/changeset/base/251697

Log:
  MFC: 235380,235454,235455,235456,235457,235613,235614,235628,236567,
       238125,238535,238660,238979,239972
  
  Bring all changes to the DTrace Toolkit into FreeBSD 9.

Added:
     - copied from r235613, head/share/dtrace/
  stable/9/share/dtrace/hotopen
     - copied unchanged from r238660, head/share/dtrace/hotopen
  stable/9/share/dtrace/nfsattrstats
     - copied unchanged from r238535, head/share/dtrace/nfsattrstats
  stable/9/share/dtrace/nfsclienttime
     - copied unchanged from r235614, head/share/dtrace/nfsclienttime
Directory Properties:
  stable/9/share/dtrace/   (props changed)
Replaced:
     - copied from r235380, head/cddl/contrib/dtracetoolkit/
Directory Properties:
  stable/9/cddl/contrib/dtracetoolkit/   (props changed)
Modified:
  stable/9/cddl/contrib/dtracetoolkit/dtruss
  stable/9/cddl/contrib/dtracetoolkit/execsnoop
  stable/9/cddl/contrib/dtracetoolkit/opensnoop
  stable/9/cddl/contrib/dtracetoolkit/procsystime
  stable/9/share/Makefile
  stable/9/share/dtrace/Makefile
  stable/9/share/dtrace/README
Directory Properties:
  stable/9/cddl/contrib/   (props changed)
  stable/9/share/   (props changed)

Modified: stable/9/cddl/contrib/dtracetoolkit/dtruss
==============================================================================
--- head/cddl/contrib/dtracetoolkit/dtruss      Sat May 12 21:25:48 2012        
(r235380)
+++ stable/9/cddl/contrib/dtracetoolkit/dtruss  Thu Jun 13 18:47:53 2013        
(r251697)
@@ -1,4 +1,4 @@
-#!/usr/bin/sh
+#!/bin/sh
 #
 # dtruss - print process system call time details.
 #          Written using DTrace (Solaris 10 3/05).
@@ -240,7 +240,7 @@ syscall:::entry
  */
 
 /* print 3 args, return as hex */
-syscall::lwp_sigmask:return
+syscall::sigprocmask:return
 /self->start/
 {
        /* calculate elapsed time */
@@ -268,10 +268,11 @@ syscall::lwp_sigmask:return
 }
 
 /* print 3 args, arg0 as a string */
+syscall::access*:return,
 syscall::stat*:return, 
 syscall::lstat*:return, 
-syscall::open*:return,
-syscall::resolvepath:return
+syscall::readlink*:return,
+syscall::open*:return
 /self->start/
 {
        /* calculate elapsed time */
@@ -329,7 +330,6 @@ syscall::*read*:return
 }
 
 /* print 0 arg output */
-syscall::gtime:return,
 syscall::*fork*:return
 /self->start/
 {
@@ -357,9 +357,6 @@ syscall::*fork*:return
 }
 
 /* print 1 arg output */
-syscall::brk:return,
-syscall::times:return,
-syscall::stime:return,
 syscall::close:return
 /self->start/
 {
@@ -387,7 +384,7 @@ syscall::close:return
 }
 
 /* print 2 arg output */
-syscall::utime:return,
+syscall::utimes:return,
 syscall::munmap:return
 /self->start/
 {

Modified: stable/9/cddl/contrib/dtracetoolkit/execsnoop
==============================================================================
--- head/cddl/contrib/dtracetoolkit/execsnoop   Sat May 12 21:25:48 2012        
(r235380)
+++ stable/9/cddl/contrib/dtracetoolkit/execsnoop       Thu Jun 13 18:47:53 
2013        (r251697)
@@ -1,25 +1,24 @@
-#!/usr/bin/sh
+#!/bin/sh
 #
 # execsnoop - snoop process execution as it occurs.
 #             Written using DTrace (Solaris 10 3/05).
 #
 # $Id: execsnoop 3 2007-08-01 10:50:08Z brendan $
 #
-# USAGE:       execsnoop [-a|-A|-ehjsvZ] [-c command]
+# USAGE:       execsnoop [-a|-A|-ehsvJ] [-c command]
 #
 #              execsnoop       # default output
 #
 #              -a              # print all data
 #              -A              # dump all data, space delimited
 #              -e              # safe output - parseable
-#              -j              # print project ID
 #              -s              # print start time, us
 #              -v              # print start time, string
-#              -Z              # print zonename
+#              -J              # print jail ID
 #              -c command      # command name to snoop
 #      eg,
 #              execsnoop -v            # human readable timestamps
-#              execsnoop -Z            # print zonename
+#              execsnoop -J            # print jail ID
 #              execsnoop -c ls         # snoop ls commands only
 #
 # The parseable output ensures that the ARGS field doesn't contain
@@ -31,8 +30,7 @@
 #              PPID            Parent Process ID
 #              COMM            command name for the process
 #              ARGS            argument listing for the process
-#              ZONE            zonename
-#              PROJ            project ID
+#              JAIL ID         Jail ID 
 #              TIME            timestamp for the command, us
 #              STRTIME         timestamp for the command, string
 #
@@ -72,34 +70,32 @@
 
 ### default variables
 opt_dump=0; opt_cmd=0; opt_time=0; opt_timestr=0; filter=0; command=.
-opt_zone=0; opt_safe=0; opt_proj=0
+opt_jailid=0; opt_safe=0
 
 ### process options
-while getopts aAc:ehjsvZ name
+while getopts aAc:ehsvJ name
 do
        case $name in
-       a)      opt_time=1; opt_timestr=1; opt_zone=1; opt_proj=1 ;;
+       a)      opt_time=1; opt_timestr=1; opt_jailid=1 ;;
        A)      opt_dump=1 ;;
        c)      opt_cmd=1; command=$OPTARG ;;
        e)      opt_safe=1 ;;
-       j)      opt_proj=1 ;;
        s)      opt_time=1 ;;
        v)      opt_timestr=1 ;;
-       Z)      opt_zone=1 ;;
+       J)      opt_jailid=1 ;;
        h|?)    cat <<-END >&2
-               USAGE: execsnoop [-a|-A|-ehjsvZ] [-c command]
+               USAGE: execsnoop [-a|-A|-ehjsvJ] [-c command]
                       execsnoop                # default output
                                -a              # print all data
                                -A              # dump all data, space delimited
                                -e              # safe output, parseable
-                               -j              # print project ID
                                -s              # print start time, us
                                -v              # print start time, string
-                               -Z              # print zonename
+                               -J              # print jail ID 
                                -c command      # command name to snoop
                  eg,
                        execsnoop -v            # human readable timestamps
-                       execsnoop -Z            # print zonename
+                       execsnoop -J            # print jail ID 
                        execsnoop -c ls         # snoop ls commands only
                END
                exit 1
@@ -108,7 +104,7 @@ done
 
 ### option logic
 if [ $opt_dump -eq 1 ]; then
-       opt_time=0; opt_timestr=0; opt_zone=0; opt_proj=0
+       opt_time=0; opt_timestr=0; opt_jailid=0
 fi
 if [ $opt_cmd -eq 1 ]; then
        filter=1
@@ -126,9 +122,8 @@ fi
  inline int OPT_cmd    = '$opt_cmd';
  inline int OPT_time   = '$opt_time';
  inline int OPT_timestr        = '$opt_timestr';
- inline int OPT_zone   = '$opt_zone';
+ inline int OPT_jailid  = '$opt_jailid';
  inline int OPT_safe   = '$opt_safe';
- inline int OPT_proj   = '$opt_proj';
  inline int FILTER     = '$filter';
  inline string COMMAND         = "'$command'";
  
@@ -143,30 +138,28 @@ fi
        /* print optional headers */
        OPT_time    ? printf("%-14s ", "TIME") : 1;
        OPT_timestr ? printf("%-20s ", "STRTIME") : 1;
-       OPT_zone    ? printf("%-10s ", "ZONE") : 1;
-       OPT_proj    ? printf("%5s ", "PROJ") : 1;
+       OPT_jailid    ? printf("%-10s ", "JAIL ID") : 1;
 
        /* print main headers */
-       OPT_dump    ? printf("%s %s %s %s %s %s %s %s\n",
-           "TIME", "ZONE", "PROJ", "UID", "PID", "PPID", "COMM", "ARGS") :
+       OPT_dump    ? printf("%s %s %s %s %s %s %s\n",
+           "TIME", "JAIL ID", "UID", "PID", "PPID", "COMM", "ARGS") :
            printf("%5s %6s %6s %s\n", "UID", "PID", "PPID", "ARGS");
  }
 
  /*
   * Print exec event
   */
- syscall::exec:return, syscall::exece:return
+ syscall::execve:return
  /(FILTER == 0) || (OPT_cmd == 1 && COMMAND == execname)/ 
  {
        /* print optional fields */
        OPT_time ? printf("%-14d ", timestamp/1000) : 1;
        OPT_timestr ? printf("%-20Y ", walltimestamp) : 1;
-       OPT_zone ? printf("%-10s ", zonename) : 1;
-       OPT_proj ? printf("%5d ", curpsinfo->pr_projid) : 1;
+       OPT_jailid ? printf("%-10d ", curpsinfo->pr_jailid) : 1;
 
        /* print main data */
-       OPT_dump ? printf("%d %s %d %d %d %d %s ", timestamp/1000,
-           zonename, curpsinfo->pr_projid, uid, pid, ppid, execname) :
+       OPT_dump ? printf("%d %d %d %d %d %s ", timestamp/1000,
+           curpsinfo->pr_jailid, uid, pid, ppid, execname) :
            printf("%5d %6d %6d ", uid, pid, ppid);
        OPT_safe ? printf("%S\n", curpsinfo->pr_psargs) :
            printf("%s\n", curpsinfo->pr_psargs);

Modified: stable/9/cddl/contrib/dtracetoolkit/opensnoop
==============================================================================
--- head/cddl/contrib/dtracetoolkit/opensnoop   Sat May 12 21:25:48 2012        
(r235380)
+++ stable/9/cddl/contrib/dtracetoolkit/opensnoop       Thu Jun 13 18:47:53 
2013        (r251697)
@@ -1,4 +1,4 @@
-#!/usr/bin/sh
+#!/bin/sh
 #
 # opensnoop - snoop file opens as they occur.
 #             Written using DTrace (Solaris 10 3/05).
@@ -189,7 +189,7 @@ fi
  /*
   * Print open event
   */
- syscall::open:entry, syscall::open64:entry
+ syscall::open:entry
  {
        /* save pathname */
        self->pathp = arg0;
@@ -203,7 +203,7 @@ fi
        /* OPT_file is checked on return to ensure pathp is mapped */
  }
 
- syscall::open:return, syscall::open64:return
+ syscall::open:return
  /self->ok && (! OPT_failonly || (int)arg0 < 0) && 
  ((OPT_file == 0) || (OPT_file == 1 && PATHNAME == copyinstr(self->pathp)))/
  {
@@ -235,7 +235,7 @@ fi
  /* 
   * Cleanup 
   */
- syscall::open:return, syscall::open64:return 
+ syscall::open:return
  /self->ok/
  {
        self->pathp = 0;

Modified: stable/9/cddl/contrib/dtracetoolkit/procsystime
==============================================================================
--- head/cddl/contrib/dtracetoolkit/procsystime Sat May 12 21:25:48 2012        
(r235380)
+++ stable/9/cddl/contrib/dtracetoolkit/procsystime     Thu Jun 13 18:47:53 
2013        (r251697)
@@ -1,4 +1,4 @@
-#!/usr/bin/sh
+#!/bin/sh
 #
 # procsystime - print process system call time details.
 #               Written using DTrace (Solaris 10 3/05).

Modified: stable/9/share/Makefile
==============================================================================
--- stable/9/share/Makefile     Thu Jun 13 18:47:28 2013        (r251696)
+++ stable/9/share/Makefile     Thu Jun 13 18:47:53 2013        (r251697)
@@ -8,6 +8,7 @@
 SUBDIR=        ${_colldef} \
        ${_dict} \
        ${_doc} \
+       dtrace \
        ${_examples} \
        ${_i18n} \
        ${_man} \

Modified: stable/9/share/dtrace/Makefile
==============================================================================
--- head/share/dtrace/Makefile  Fri May 18 16:40:15 2012        (r235613)
+++ stable/9/share/dtrace/Makefile      Thu Jun 13 18:47:53 2013        
(r251697)
@@ -12,9 +12,9 @@ SUBDIR= ${_toolkit}
 _toolkit=      toolkit
 .endif
 
-SCRIPTS=       nfsclienttime
+SCRIPTS=       nfsclienttime hotopen
 
-SCRIPTSDIR= ${SHAREDIR}/dtrace/
+SCRIPTSDIR= ${SHAREDIR}/dtrace
 
 NO_OBJ=
 

Modified: stable/9/share/dtrace/README
==============================================================================
--- head/share/dtrace/README    Fri May 18 16:40:15 2012        (r235613)
+++ stable/9/share/dtrace/README        Thu Jun 13 18:47:53 2013        
(r251697)
@@ -2,7 +2,7 @@ $FreeBSD$
 
 This directory contains scripts for use with the DTrace system.  The
 toolkit/ directory contains the latest vendor import of Brendan
-Gregg's DTRaceToolkit while all the other files and directories
+Gregg's DTraceToolkit while all the other files and directories
 contain code generated by the FreeBSD Project for use with DTrace on
 FreeBSD.
 

Copied: stable/9/share/dtrace/hotopen (from r238660, head/share/dtrace/hotopen)
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/9/share/dtrace/hotopen       Thu Jun 13 18:47:53 2013        
(r251697, copy of r238660, head/share/dtrace/hotopen)
@@ -0,0 +1,61 @@
+#!/bin/sh
+#
+# Copyright (c) 2012 George V. Neville-Neil
+# All rights reserved.
+#
+# This software was developed at the University of Cambridge Computer
+# Laboratory with support from a grant from Google, Inc.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+# The hotopen D script periodically outputs  table of which UIDs
+# are opening files.   This is a very quick way to find out if
+# a paritcular user is thrashing a system with rapid calls to
+# open/close.
+#
+# Usage: hotopen
+#
+
+/usr/sbin/dtrace -n '
+#pragma D option quiet
+BEGIN
+{
+       printf("Files opened per UID in the last second.\n");
+}
+
+syscall::open:entry
+{
+       @files[uid] = count();
+       output = 1;
+}
+
+tick-1sec
+/output != 0/
+{
+       printf("%-20Y \n", walltimestamp);
+       printa("uid %d\tcount %@d\n", @files, @files);
+       trunc(@files);
+       output = 0;
+}
+'

Copied: stable/9/share/dtrace/nfsattrstats (from r238535, 
head/share/dtrace/nfsattrstats)
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/9/share/dtrace/nfsattrstats  Thu Jun 13 18:47:53 2013        
(r251697, copy of r238535, head/share/dtrace/nfsattrstats)
@@ -0,0 +1,74 @@
+#!/bin/sh
+#
+# Copyright (c) 2012 Robert N. M. Watson
+# All rights reserved.
+#
+# This software was developed at the University of Cambridge Computer
+# Laboratory with support from a grant from Google, Inc.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+# This script creates a trace of NFS RPCs, NFS attribute cache
+# activity, and NFS access cache activity, along with the system call
+# that instigated the activity. Notice that NFS events may happen
+# outside of the context of a system call, most likely due to the VM
+# system paging from NFS, in which case the system call name is
+# reported as "-"
+
+/usr/sbin/dtrace -n '
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+       printf("probe\targ0\texecutable\tsyscall\n");
+}
+
+syscall:::entry
+{
+
+        self->syscallname = probefunc;
+}
+
+syscall:::return
+{
+
+        self->syscallname = "";
+}
+
+nfsclient:::
+/self->syscallname != 0 && self->syscallname != ""/
+{
+
+    printf("%s\t%s\t%s\t%s\n", probemod, stringof(arg0), execname, 
+           self->syscallname);
+}
+
+nfsclient:::
+/self->syscallname == 0 || self->syscallname == ""/
+{
+
+    printf("%s\t%s\t%s\t%s\n", probemod, stringof(arg0), execname, 
+           self->syscallname);
+}
+'

Copied: stable/9/share/dtrace/nfsclienttime (from r235614, 
head/share/dtrace/nfsclienttime)
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/9/share/dtrace/nfsclienttime Thu Jun 13 18:47:53 2013        
(r251697, copy of r235614, head/share/dtrace/nfsclienttime)
@@ -0,0 +1,74 @@
+#!/bin/sh
+#
+# Copyright (c) 2012 Robert N. M. Watson
+# All rights reserved.
+#
+# This software was developed at the University of Cambridge Computer
+# Laboratory with support from a grant from Google, Inc.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+# This script measures all time spent waiting on RPC replies for each
+# system call, and then generates a histogram of those times sorted by
+# system call name.
+#
+# Currently only supports NFSv3
+#
+# Usage: nfsclienttime
+#
+# Press Ctrl-C to exit and display statistics.
+#
+
+/usr/sbin/dtrace -n '
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+       printf("Collecting data...press Ctrl-C to exit.\n");
+}
+
+syscall:::entry
+{
+
+        self->count = 0;
+}
+
+nfsclient:nfs3::start
+{
+
+        self->timestamp = timestamp;
+}
+
+nfsclient:nfs3::done
+{
+
+        self->count += (timestamp - self->timestamp);
+}
+
+syscall:::return
+/self->count != 0/  {
+
+        @syscalls[probefunc] = quantize(self->count);
+}
+'
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to