Date: Sun, 2 Oct 2011 11:26:24 -0700 From: mdf@FreeBSD.org To: lev@freebsd.org Cc: freebsd-hackers@freebsd.org Subject: Re: Way to get current tick number in kernel? Message-ID: <CAMBSHm9jB5pZZxvghSUBoXmk2TOcj-iEfcgpHQEnCpsHUNj8Uw@mail.gmail.com> In-Reply-To: <1076522387.20111002163542@serebryakov.spb.ru> References: <1076522387.20111002163542@serebryakov.spb.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
2011/10/2 Lev Serebryakov <lev@freebsd.org>: > 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAMBSHm9jB5pZZxvghSUBoXmk2TOcj-iEfcgpHQEnCpsHUNj8Uw>