From owner-freebsd-current@FreeBSD.ORG Fri Feb 25 02:12:06 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 929A9106566B for ; Fri, 25 Feb 2011 02:12:06 +0000 (UTC) (envelope-from doconnor@gsoft.com.au) Received: from cain.gsoft.com.au (cain.gsoft.com.au [203.31.81.10]) by mx1.freebsd.org (Postfix) with ESMTP id 18AD48FC0A for ; Fri, 25 Feb 2011 02:12:05 +0000 (UTC) Received: from ur.gsoft.com.au (Ur.gsoft.com.au [203.31.81.44]) (authenticated bits=0) by cain.gsoft.com.au (8.14.4/8.14.3) with ESMTP id p1P2BxxK011835 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Fri, 25 Feb 2011 12:42:00 +1030 (CST) (envelope-from doconnor@gsoft.com.au) Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii From: "Daniel O'Connor" In-Reply-To: <4D6291A5.4050206@netasq.com> Date: Fri, 25 Feb 2011 12:41:58 +1030 Content-Transfer-Encoding: quoted-printable Message-Id: <0691A273-3363-4FC2-B2C6-5995A628C801@gsoft.com.au> References: <4D6291A5.4050206@netasq.com> To: Jerome Flesch X-Mailer: Apple Mail (2.1082) X-Spam-Score: -2.51 () ALL_TRUSTED,BAYES_00,T_RP_MATCHES_RCVD X-Scanned-By: MIMEDefang 2.67 on 203.31.81.10 Cc: freebsd-current@freebsd.org Subject: Re: Process timing issue X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Feb 2011 02:12:06 -0000 On 22/02/2011, at 2:54, Jerome Flesch wrote: > While investigating a timing issue with one of our program, we found = out something weird: We've written a small test program that just calls = clock_gettime() a lot of times and checks that the time difference = between calls makes sense. In the end, it seems it doesn't always do. >=20 > Calling twice in a row clock_gettime() takes usually less than 1ms. = But with an average load, about 1 time in 200000, more than 10ms are = spent between both calls for no apparent reason. According to our tests, = when it happens, the time between both calls can go from few = milliseconds to many seconds (our best score so far is 10 seconds :). = Same goes for gettimeofday(). >=20 > To reproduce this issue, we use the small test program joined to this = mail and openssl speed test commands (usually 'openssl speed -elapsed = dsa2048'). It only appears if one of these openssl speed test run on the = same core than our test progam, so we have to start as many openssl = instances as there are cores on the test computer. This sounds like a problem I have trying to read from a FIFO in hardware = over USB. Most of the time the libusb poll thread doesn't take very long, but = every now and then it takes too long and my FIFO fills up (~75msec). If you do find a solution I would be very interested :) In the end I wrote a kernel driver which read & buffered the data, but I = suppose that is not possible for you. -- Daniel O'Connor software and network engineer for Genesis Software - http://www.gsoft.com.au "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C