From owner-freebsd-hackers@FreeBSD.ORG Sun Oct 2 18:26:26 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4191A106564A for ; Sun, 2 Oct 2011 18:26:26 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-qy0-f182.google.com (mail-qy0-f182.google.com [209.85.216.182]) by mx1.freebsd.org (Postfix) with ESMTP id DCF0C8FC13 for ; Sun, 2 Oct 2011 18:26:25 +0000 (UTC) Received: by qyk4 with SMTP id 4so3286560qyk.13 for ; Sun, 02 Oct 2011 11:26:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=/+rBO+upofJnj9W4k9tD/WmZaCTRHhZvHc7b2SXfMfY=; b=VL1sOIBwcMcFPmHw+fL07FfR6pI5T2QE9fnUVA+V4n8uA6p0AU9Jm4SmgoQqI6xlYY 2oNV0bW5Ufl5ZwHDbGsM8XnUvtshsUel6LhDEV+LsgDRYkcHiqTuOqWdS7saIpvSOzep cWvgeY6IXtPQoaRSWnf31EF/Q30TTvsQvQzdw= MIME-Version: 1.0 Received: by 10.229.69.142 with SMTP id z14mr10531758qci.167.1317579984939; Sun, 02 Oct 2011 11:26:24 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.229.83.196 with HTTP; Sun, 2 Oct 2011 11:26:24 -0700 (PDT) In-Reply-To: <1076522387.20111002163542@serebryakov.spb.ru> References: <1076522387.20111002163542@serebryakov.spb.ru> Date: Sun, 2 Oct 2011 11:26:24 -0700 X-Google-Sender-Auth: 71AZvNyl6x5I5w40Gc-ogaV9Yys Message-ID: From: mdf@FreeBSD.org To: lev@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org Subject: Re: Way to get current tick number in kernel? 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: Sun, 02 Oct 2011 18:26:26 -0000 2011/10/2 Lev Serebryakov : > Hello, Freebsd-hackers. > > =A0What should I use to measure short intervals of time between events > in kernel? I don't need any "time" in means of, for example, time(3) > API, but some monotonically and uniformly increasing counter with > known frequency. As cheap as possible, without complex calculations :) There are several global variables that may suffice. 'ticks' is the current tick value. 'time_second' is the current time in seconds, but this is adjusted when the system time is changed. 'time_uptime' is the current uptime in seconds and is the base upon which time_second is computed, depending on the system clock. Cheers, matthew