From owner-freebsd-net@FreeBSD.ORG Mon Jul 28 20:37:19 2014 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B8D2A930; Mon, 28 Jul 2014 20:37:19 +0000 (UTC) Received: from mail-oi0-x234.google.com (mail-oi0-x234.google.com [IPv6:2607:f8b0:4003:c06::234]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 73A2A2F95; Mon, 28 Jul 2014 20:37:19 +0000 (UTC) Received: by mail-oi0-f52.google.com with SMTP id h136so6464802oig.25 for ; Mon, 28 Jul 2014 13:37:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=yA9pTcDKz/LlR2usnUPpr6r/ORhje5Q98ij1UolRbcg=; b=U1jdd27vDImeFv/aqa4zbAkVUEsWpz7qAEACQWCWHJSFXg8uyBjTW0XMbRR3NvxMvx XKQQR50KelqS4FGcECWlSjaaUV4JoDAtbz2bbMQWk3wPJpG2iUo5AR38fqMdN9YYDAKM Oc/ostIQzjc5IDrvCFJx2DXBe7BKSqJBjgXrEeS+EPB1VSFrUG1BBjnGSuBd4Uj2kAe3 LF/SRgXDrLf7rjcnO/92mdpFigvC3lX9ob/3YnBi45Ov0OLGTorCI+KVHdc5EhYZ/v/a O4M1IQzecgOwoo+1rwVcp01wynoEDUQ31QVVcxMAQwflupQoaK4m6YCCvGBCS48i5wMw dUOA== MIME-Version: 1.0 X-Received: by 10.60.132.176 with SMTP id ov16mr53192103oeb.13.1406579838792; Mon, 28 Jul 2014 13:37:18 -0700 (PDT) Received: by 10.76.213.7 with HTTP; Mon, 28 Jul 2014 13:37:18 -0700 (PDT) In-Reply-To: <83597B15-63B3-4AD7-A458-00B67C9E5396@neville-neil.com> References: <53CE80DD.9090109@gmail.com> <53CEB090.7030701@gmail.com> <53CEB670.9060600@gmail.com> <53CEB9B5.7020609@gmail.com> <83597B15-63B3-4AD7-A458-00B67C9E5396@neville-neil.com> Date: Mon, 28 Jul 2014 16:37:18 -0400 Message-ID: Subject: Re: fastforward/routing: a 3 million packet-per-second system? From: Ryan Stone To: George Neville-Neil Content-Type: text/plain; charset=UTF-8 Cc: FreeBSD Net , Adrian Chadd , John Jasen , Navdeep Parhar X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 20:37:19 -0000 On Sun, Jul 27, 2014 at 4:42 PM, George Neville-Neil wrote: > Chiming in late, but don't you mean instruction-retired instead of > CPU_CLK_UNHALTED_CORE? > > Best, > George In my experience instruction-retired gives very misleading profiler output in most cases. The problem is that instruction-retired gives equal weight to all instructions, which means that it does not take into account instructions with long latencies because they (for example) missed the cache. CPU_CLK_UNHALTED_CORE (or its alias, unhalted-cycles) is a much better event because it is a nearer proxy for time-based sampling, which is really what you're interested in when trying to reduce runtime of processes. My one big complaint with unhalted-cycles is that it does not take into effect CPU time spent in busy-wait loops that use the pause instruction, so it vastly unweights time spent adaptively spinning on kernel mutexes, for instance. I'm also not sure what it does when the CPU is adjusting its frequency, but that's not a case that I ever have to deal with personally.