From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 4 07:48:19 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8BA52106564A for ; Mon, 4 Jun 2012 07:48:19 +0000 (UTC) (envelope-from slobodyanyuk.sergey@gmail.com) Received: from mail-ey0-f182.google.com (mail-ey0-f182.google.com [209.85.215.182]) by mx1.freebsd.org (Postfix) with ESMTP id 19DC28FC12 for ; Mon, 4 Jun 2012 07:48:18 +0000 (UTC) Received: by eaac13 with SMTP id c13so786284eaa.13 for ; Mon, 04 Jun 2012 00:48:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type; bh=N9tNAhM+v3wG52r8P5uLbBJXeg7Dufq6PC/ZMdtQM1s=; b=qB8nDFpJD6sSmldR+kdEj6aVa0Au+EsodzhLKdyDgHuVeIw8GuHZa1+gCurXT8Pgae Drb17tjYNOb/S516Qxx9n2M4ATdUGiXVKCtdKmJcRMAk/1tBJOANAOb9//1kUW/mWkDm G4y1yF/W5pX2Yn3YXMkEndiCyW9hvAY3tBgjoF6VChvNfv9629rSb1V7fe5HWNMDdoY1 hVoeLfgR4x10T3wOvNfBxBGJYcjOEeZ220MGeIAcJ9qsQ0JWpXZLasIxdi2c5NjmGI+M 6Tk26EKl+hMOiD7AYYeoojQTD+8NMgaHPnqly/7+paTK3mPhk5YfQ7g/pyZem6Qcm+sh 3soA== MIME-Version: 1.0 Received: by 10.14.127.138 with SMTP id d10mr4536406eei.171.1338796097894; Mon, 04 Jun 2012 00:48:17 -0700 (PDT) Sender: slobodyanyuk.sergey@gmail.com Received: by 10.14.37.12 with HTTP; Mon, 4 Jun 2012 00:48:17 -0700 (PDT) Date: Mon, 4 Jun 2012 10:48:17 +0300 X-Google-Sender-Auth: mqADYckHtMuVyaipxUFliQ3oO6g Message-ID: From: Sergey Slobodyanyuk To: killing@multiplay.co.uk Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-hackers@freebsd.org Subject: Re:dtrace filename lookups from fd (Serg Slobodyanyuk) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2012 07:48:19 -0000 > > > Date: Fri, 1 Jun 2012 17:00:20 +0100 > From: "Steven Hartland" > > As a first foray into dtrace I wanted to create a little > script which shows the amount of disk read / write activity. > > Now the DtraceToolkit includes rwsnoop but this uses Solaris > specific requests and on looking around it seems like > using rwsnoop vn_fullpath may be the way to go. > > Has anyone done anything similar to this before or has any > tips on going about this? > > Regards > Steve > HI, Some times ago I decided to do the same - port rwsnoop to FreeBSD(8.2 R). FreeBSD vfs code quiet different from solaris code so I asked for help Kostik and he directed me to vn_fullpath() routine after that I wrote working port of rwsnoop. But script generate alot of errors like "invalid address (0x....) in action" even on data that should be there(from my point of view). After several tries to debug it I left it as is. You can run it with "| grep -v invalid" or direct STDERR to /dev/null. Maybe Hackers could look at it and say what's wrong :-) Changed part of code: this->fp = &(curthread->td_proc->p_fd->fd_ofiles[self->fd]); this->vp = (struct vnode *)((*(this->fp))->f_vnode); this->cache_dst = &((this->vp)->v_cache_dst); this->ncp = (&((this->vp)->v_cache_dst)) != NULL ? (&((this->vp)->v_cache_dst))->tqh_first : 0; self->ncname = this->ncp ? (this->ncp->nc_name != 0 ? stringof(this->ncp->nc_name) : "") : "" Link to script: https://docs.google.com/open?id=0B7olr28SbDyNZktLMG51UHVxNW8 //Br. Serg