From owner-freebsd-questions@freebsd.org Sun Jan 10 15:57:38 2016 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23001A69540 for ; Sun, 10 Jan 2016 15:57:38 +0000 (UTC) (envelope-from smithi@nimnet.asn.au) Received: from sola.nimnet.asn.au (paqi.nimnet.asn.au [115.70.110.159]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D59A12D4 for ; Sun, 10 Jan 2016 15:57:37 +0000 (UTC) (envelope-from smithi@nimnet.asn.au) Received: from localhost (localhost [127.0.0.1]) by sola.nimnet.asn.au (8.14.2/8.14.2) with ESMTP id u0AFvRDE057520 for ; Mon, 11 Jan 2016 02:57:28 +1100 (EST) (envelope-from smithi@nimnet.asn.au) Date: Mon, 11 Jan 2016 02:57:27 +1100 (EST) From: Ian Smith To: freebsd-questions@freebsd.org Subject: Task to busy one CPU 100% for a period of time? Message-ID: <20160111002439.Q93547@sola.nimnet.asn.au> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2016 15:57:38 -0000 Hi crew, hopefully refreshed and sharp as tacks from a holiday! I've been doing extensive testing of load average reporting using different eventtimers (HPET and LAPIC) on stable/9 on a Lenovo X200, 2.4GHz Core2Duo, at idle and with one, two and four fully CPU-bound processes that are configured to run for ~15.5 minutes on my system. When load averages are being correctly accounted, this produces results for one-minute averages of 0.00 at idle, 0.99-1.00 with one such task running, 1.99-2.00 for two and 3.99-4.00 for four, as expected. 5 and 15 minute LAs respectively take longer to get up toward the same points, and correspondingly much longer to sink back to 0.00, also as expected. When not being correctly accounted, in otherwise the same environment, this method provides good clues to the extent of errors over this range. For this I've been using a program of mine that I know only does a very large number of fixed and floating point operations, and beyond reading a config file and around 7 1/2 KB records, uses no I/O nor other system calls at all in its main loop, when configured with 'nowrite' - or each instance would generate a 2.4GB 72-minute 96kHz 24-bit stereo .wav file! However it's a large Pascal program, not ready for release nor in a form that others could readily use to reproduce my results, and I'm at the point where I need to be able to post a method of doing just that. So I'm looking for some utility, preferably in the base system but a port/pkg could do, that can just burn one CPU (ie is single-threaded) for a specified number of iterations. And not for a specified time - which would use system time to query time - nor in any interpreted (syscall-rich) language. A little pre- and/or post-loop reporting is not a problem. I'm likely missing something quite obvious; suggestions welcome. cheers, Ian (please cc me, I'm subscribed to the daily digest)