From owner-freebsd-hackers@FreeBSD.ORG Mon Nov 21 17:00:02 2011 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0D1C1065674 for ; Mon, 21 Nov 2011 17:00:02 +0000 (UTC) (envelope-from rysto32@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 545688FC1D for ; Mon, 21 Nov 2011 17:00:02 +0000 (UTC) Received: by eyd10 with SMTP id 10so7911788eyd.13 for ; Mon, 21 Nov 2011 09:00:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=syuaTA6QUvliN5mpZb+2QBak7o1SN6f+vwW4uZWKbco=; b=XoqFdYkkpPDO6y8tLHpoWBBSXDK0U3DhU5aZK8/tHO1vxbohNFAGxopkvVuWJlvTmg UQo2BzeNRMzJEYasNGe+EWrR/BPbAvT4+KlvekDdX48hZFJ1oraLHSqnAGyK62v3Fbdm GlMyZC8lCTdqU85JiCSfANR1z/LDWn17dVagY= MIME-Version: 1.0 Received: by 10.180.24.65 with SMTP id s1mr14652240wif.59.1321893441182; Mon, 21 Nov 2011 08:37:21 -0800 (PST) Received: by 10.180.95.104 with HTTP; Mon, 21 Nov 2011 08:37:21 -0800 (PST) In-Reply-To: <4EC9EE5A.2070204@grosbein.pp.ru> References: <4EC39367.4030109@rdtc.ru> <4EC9EE5A.2070204@grosbein.pp.ru> Date: Mon, 21 Nov 2011 11:37:21 -0500 Message-ID: From: Ryan Stone To: Eugene Grosbein Content-Type: text/plain; charset=ISO-8859-1 Cc: hackers@freebsd.org Subject: Re: dummynet(4) kernel process CPU usage monitoring 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, 21 Nov 2011 17:00:02 -0000 On Mon, Nov 21, 2011 at 1:23 AM, Eugene Grosbein wrote: > Hi! > > I need to draw graph of dummynet's CPU usage. > "procstat -t 0" shows me TID (thread id) of dummynet kernel thread. > "ps -Hxo time,lwp" shows me total CPU time consumed by this thread. > > Now I see this time has 9 seconds increase during 60 seconds of real time. > This should be 9/60=15% CPU usage, but "top -SHP" shows me 0.00% meantime. > > Where is my error? > > Eugene Grosbein Which version are you running? 8.1-RELEASE and older have the problem that the scheduler and the CPU statistics gatherer are driven from the same clock. For threads that tend to frequently wake up and run for less than a full tick(dummynet would appear to fall in this category) this means that CPU usage statistics are never captured at a point where those threads are running, so top shows 0% for those threads. I am told that some relatively recent timer-related work(eventtimer?) should have resolved the issue, which is definitely in 9.0 and might be in stable/8 and may even have made it into 8.2-RELEASE.