From nobody Tue Jul 19 14:09:30 2022 X-Original-To: questions@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4LnLLL3qc7z4XP1Y for ; Tue, 19 Jul 2022 14:09:30 +0000 (UTC) (envelope-from freebsd-doc@fjl.co.uk) Received: from bs1.fjl.org.uk (bs1.fjl.org.uk [84.45.41.196]) by mx1.freebsd.org (Postfix) with ESMTP id 4LnLLK6VhWz3ZJj for ; Tue, 19 Jul 2022 14:09:29 +0000 (UTC) (envelope-from freebsd-doc@fjl.co.uk) Received: from [192.168.1.150] (host86-177-85-20.range86-177.btcentralplus.com [86.177.85.20]) (authenticated bits=0) by bs1.fjl.org.uk (8.14.4/8.14.4) with ESMTP id 26JE9TVG077000 for ; Tue, 19 Jul 2022 15:09:29 +0100 (BST) (envelope-from freebsd-doc@fjl.co.uk) Message-ID: <1c2043cd-0db0-6df5-ffae-4adcd55dc1c7@fjl.co.uk> Date: Tue, 19 Jul 2022 15:09:30 +0100 List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 From: Frank Leonhardt Subject: Re: How do get elapsed time in milliseconds in a shell script? To: questions@freebsd.org References: <20220712194432.AA49E458B955@ary.qy> <20220712205754.928c3f921f42f66fb977f891@sohara.org> <77a16f8f-a70a-3abf-02be-70b1d252bd36@iecc.com> <735428d6-aeeb-2539-c1fa-aee0baf2506e@fjl.co.uk> <20220718154227.0b56d2e08c41b1849769c49f@sohara.org> Content-Language: en-GB In-Reply-To: <20220718154227.0b56d2e08c41b1849769c49f@sohara.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4LnLLK6VhWz3ZJj X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of freebsd-doc@fjl.co.uk designates 84.45.41.196 as permitted sender) smtp.mailfrom=freebsd-doc@fjl.co.uk X-Spamd-Result: default: False [-2.19 / 15.00]; SUBJECT_ENDS_QUESTION(1.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; NEURAL_HAM_LONG(-0.99)[-0.995]; R_SPF_ALLOW(-0.20)[+ip4:84.45.41.196:c]; MIME_GOOD(-0.10)[text/plain]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; MLMMJ_DEST(0.00)[questions@freebsd.org]; TO_DN_NONE(0.00)[]; ASN(0.00)[asn:25577, ipnet:84.45.0.0/17, country:GB]; FROM_HAS_DN(0.00)[]; DMARC_NA(0.00)[fjl.co.uk]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; PREVIOUSLY_DELIVERED(0.00)[questions@freebsd.org]; MID_RHS_MATCH_FROM(0.00)[] X-ThisMailContainsUnwantedMimeParts: N On 18/07/2022 15:42, Steve O'Hara-Smith wrote: > On Mon, 18 Jul 2022 14:01:01 +0100 > freebsd-doc@fjl.co.uk wrote: > >> I think what may be needed is a base utility to produce the accurate >> tick since the epoch or boot - it doesn't' matter for timeing. Possibly >> an extension to "uptime", which I assume must know. > There are some counters exposed via sysctl which might be useful, > kern.timecounter.tc.HPET.counter looks promising, the rest seem to cycle > rather quickly. Of course portability is an issue with using these. Yes - looks good to me, but not portable. Best FreeBSD-specific method so far.