summaryrefslogtreecommitdiff
path: root/sys/kern/kern_clock.c
Commit message (Collapse)AuthorAgeFilesLines
* Add a member function more to the timecounters, this one is for usePoul-Henning Kamp1998-06-071-6/+32
| | | | | | | | with latch based PPS implementations. The client that uses it will be committed after more testing. Notes: svn path=/head/; revision=36741
* Add a "this" style argument and a "void *private" so timecounters canPoul-Henning Kamp1998-06-071-7/+7
| | | | | | | figure out which instance to wount with. Notes: svn path=/head/; revision=36719
* Some cleanups related to timecounters and weird ifdefs in <sys/time.h>.Poul-Henning Kamp1998-05-281-11/+16
| | | | | | | | | | | | | | | | | | | | | | | Clean up (or if antipodic: down) some of the msgbuf stuff. Use an inline function rather than a macro for timecounter delta. Maintain process "on-cpu" time as 64 bits of microseconds to avoid needless second rollover overhead. Avoid calling microuptime the second time in mi_switch() if we do not pass through _idle in cpu_switch() This should reduce our context-switch overhead a bit, in particular on pre-P5 and SMP systems. WARNING: Programs which muck about with struct proc in userland will have to be fixed. Reviewed, but found imperfect by: bde Notes: svn path=/head/; revision=36441
* Change a data type internal to the timecounters, and remove the "delta"Poul-Henning Kamp1998-05-191-27/+14
| | | | | | | | | function. Reviewed, but not entirely approved by: bde Notes: svn path=/head/; revision=36199
* s/nanoruntime/nanouptime/gPoul-Henning Kamp1998-05-171-6/+6
| | | | | | | | | s/microruntime/microuptime/g Reviewed by: bde Notes: svn path=/head/; revision=36119
* Minor adjustments to the timecounting and proc0.Poul-Henning Kamp1998-04-081-3/+3
| | | | | | | Mostly Submitted by: bde Notes: svn path=/head/; revision=35099
* Make a kernel version of the timer* functions called timerval* to bePoul-Henning Kamp1998-04-061-3/+3
| | | | | | | | | more consistent. OK'ed by: bde Notes: svn path=/head/; revision=35058
* Make the dummy timecounter run at 1 MHz rather than 100kHz (noticed by bde)Poul-Henning Kamp1998-04-051-2/+2
| | | | | | | fix the itimer(REAL) handling. Notes: svn path=/head/; revision=35044
* Handle double fraction overflow in nano & microtime functions (spotted by Bruce)Poul-Henning Kamp1998-04-041-3/+3
| | | | | | | Use tvtohz() a place where it fits. Notes: svn path=/head/; revision=35033
* Time changes mark 2:Poul-Henning Kamp1998-04-041-37/+90
| | | | | | | | | | | | | | | | | | | | * Figure out UTC relative to boottime. Four new functions provide time relative to boottime. * move "runtime" into struct proc. This helps fix the calcru() problem in SMP. * kill mono_time. * add timespec{add|sub|cmp} macros to time.h. (XXX: These may change!) * nanosleep, select & poll takes long sleeps one day at a time Reviewed by: bde Tested by: ache and others Notes: svn path=/head/; revision=35029
* Fix an off by 1<<32 error.Poul-Henning Kamp1998-03-311-2/+2
| | | | Notes: svn path=/head/; revision=34975
* Add a dummy timecounter until we find the real thing(s).Poul-Henning Kamp1998-03-311-4/+36
| | | | Notes: svn path=/head/; revision=34974
* Eradicate the variable "time" from the kernel, using various measures.Poul-Henning Kamp1998-03-301-17/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "time" wasn't a atomic variable, so splfoo() protection were needed around any access to it, unless you just wanted the seconds part. Most uses of time.tv_sec now uses the new variable time_second instead. gettime() changed to getmicrotime(0. Remove a couple of unneeded splfoo() protections, the new getmicrotime() is atomic, (until Bruce sets a breakpoint in it). A couple of places needed random data, so use read_random() instead of mucking about with time which isn't random. Add a new nfs_curusec() function. Mark a couple of bogosities involving the now disappeard time variable. Update ffs_update() to avoid the weird "== &time" checks, by fixing the one remaining call that passwd &time as args. Change profiling in ncr.c to use ticks instead of time. Resolution is the same. Add new function "tvtohz()" to avoid the bogus "splfoo(), add time, call hzto() which subtracts time" sequences. Reviewed by: bde Notes: svn path=/head/; revision=34961
* Add two new functions, get{micro|nano}time.Poul-Henning Kamp1998-03-261-12/+30
| | | | | | | | | | | | | | | They are atomic, but return in essence what is in the "time" variable. gettime() is now a macro front for getmicrotime(). Various patches to use the two new functions instead of the various hacks used in their absence. Some puntuation and grammer patches from Bruce. A couple of XXX comments. Notes: svn path=/head/; revision=34901
* A bunch of BNN (Bruce Normal Nits) from bde:Poul-Henning Kamp1998-03-161-55/+92
| | | | | | | | | Bring back the softclock inlining save a couple of <<32's many white-space shuffles. Notes: svn path=/head/; revision=34618
* Replace TOD clock code with more systematic approach.Poul-Henning Kamp1998-02-201-94/+241
| | | | | | | | | | | | | | | | | | Highlights: * Simple model for underlying hardware. * Hardware basis for timekeeping can be changed on the fly. * Only one hardware clock responsible for TOD keeping. * Provides a real nanotime() function. * Time granularity: .232E-18 seconds. * Frequency granularity: .238E-12 s/s * Frequency adjustment is continuous in time. * Less overhead for frequency adjustment. * Improves xntpd performance. Reviewed by: bde, bde, bde Notes: svn path=/head/; revision=33690
* Add a nanotime() function so that we can start to use this call.Poul-Henning Kamp1998-02-151-1/+10
| | | | Notes: svn path=/head/; revision=33391
* Back out DIAGNOSTIC changes.Eivind Eklund1998-02-061-3/+1
| | | | Notes: svn path=/head/; revision=33134
* Turn DIAGNOSTIC into a new-style option.Eivind Eklund1998-02-041-1/+3
| | | | Notes: svn path=/head/; revision=33108
* Move almost all the ntp related stuff from kern_clock.c toPoul-Henning Kamp1998-01-141-660/+47
| | | | | | | | | kern_ntptime.c. The only bit left over is that which is executed in all calls to hardclock(). Various cleanups and staticizing along the road. Notes: svn path=/head/; revision=32513
* Try to solve timeout race by not touching softtics here.Poul-Henning Kamp1998-01-111-4/+2
| | | | Notes: svn path=/head/; revision=32444
* Fix softclock calling so we don't loose timeouts (I broke this ~10h ago)Poul-Henning Kamp1998-01-111-2/+6
| | | | Notes: svn path=/head/; revision=32412
* Whoops. softclock is called from doreti_swi as well. Abandon call fromPoul-Henning Kamp1998-01-101-3/+3
| | | | | | | | | | | hardclock(). Forgot this: Pointed hat sent by: bd Notes: svn path=/head/; revision=32391
* Effect the divorce of kern_clock.c and kern_timeout.c (which wasPoul-Henning Kamp1998-01-101-283/+2
| | | | | | | repository copied from kern_clock.c) Notes: svn path=/head/; revision=32388
* Improve hardpps readability a bit:Poul-Henning Kamp1998-01-071-50/+45
| | | | | | | | * Rename usec to p_usec so you can search for it. * Macroize the huge median_of_3_samples if statement. Notes: svn path=/head/; revision=32323
* This patch causes the "calltodo" timer list to be decremented by the amountNate Williams1997-12-231-1/+68
| | | | | | | | | | | | | | | | | | | | | | | | | of time that the laptop was suspending. Thus, select() calls that might have suspended rather than firing at 1hr + "time suspended" since the timer was posted. Adding: options APM_FIXUP_CALLTODO to the kernel config enables the patch. [ This patch was slightly modified to use a consistant indent style and I removed some unused local variables. After this has been tested a few weeks we'll make the options the default, so for now I'm now documenting it in LINT. Mike can later if he wants. ] Reviewed by: Mike Smith <msmith@freebsd.org> Submitted by: Ken Key <key@cs.utk.edu> Notes: svn path=/head/; revision=31950
* The improvements to clock statistics by Tor EggeSteve Passe1997-12-081-1/+20
| | | | | | | | | | Wrappered and enabled by the define BETTER_CLOCK (on by default in smpyests.h) Reviewed by: smp@csn.net Submitted by: Tor Egge <Tor.Egge@idi.ntnu.no> Notes: svn path=/head/; revision=31639
* Removed all traces of P_IDLEPROC. It was tested but never set.Bruce Evans1997-11-241-2/+2
| | | | Notes: svn path=/head/; revision=31393
* Removed unused #include.Bruce Evans1997-11-181-3/+1
| | | | Notes: svn path=/head/; revision=31259
* Remove a bunch of variables which were unused both in GENERIC and LINT.Poul-Henning Kamp1997-11-071-3/+1
| | | | | | | Found by: -Wunused Notes: svn path=/head/; revision=31016
* Store an absolute tick value in callout entries so that a subtraction onJustin T. Gibbs1997-09-241-10/+18
| | | | | | | | | | | hash chain traversal isn't needed. This also allows untimeout to recompute the hash to find the bucket that the entry to remove is stored in so that each callout entry no longer needs to store that information. Reviewed by: Nate Williams <nate@mt.sri.com> Notes: svn path=/head/; revision=29805
* init_main.c subr_autoconf.c:Justin T. Gibbs1997-09-211-81/+115
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for "interrupt driven configuration hooks". A component of the kernel can register a hook, most likely during auto-configuration, and receive a callback once interrupt services are available. This callback will occur before the root and dump devices are configured, so the configuration task can affect the selection of those two devices or complete any tasks that need to be performed prior to launching init. System boot is posponed so long as a hook is registered. The hook owner is responsible for removing the hook once their task is complete or the system boot can continue. kern_acct.c kern_clock.c kern_exit.c kern_synch.c kern_time.c: Change the interface and implementation for the kernel callout service. The new implemntaion is based on the work of Adam M. Costello and George Varghese, published in a technical report entitled "Redesigning the BSD Callout and Timer Facilities". The interface used in FreeBSD is a little different than the one outlined in the paper. The new function prototypes are: struct callout_handle timeout(void (*func)(void *), void *arg, int ticks); void untimeout(void (*func)(void *), void *arg, struct callout_handle handle); If a client wishes to remove a timeout, it must store the callout_handle returned by timeout and pass it to untimeout. The new implementation gives 0(1) insert and removal of callouts making this interface scale well even for applications that keep 100s of callouts outstanding. See the updated timeout.9 man page for more details. Notes: svn path=/head/; revision=29680
* Some staticized variables were still declared to be extern.Bruce Evans1997-09-071-2/+2
| | | | Notes: svn path=/head/; revision=29179
* Removed unused #includes.Bruce Evans1997-09-021-3/+1
| | | | Notes: svn path=/head/; revision=29041
* #include <machine/limits.h> explicitly in the few places that it is required.Bruce Evans1997-08-211-1/+2
| | | | Notes: svn path=/head/; revision=28551
* Add tickadj to struct clockinfo, like NetBSD and OpenBSD.John Hay1997-06-241-1/+2
| | | | | | | NOTE: libc, time, kgmon and rpc.rstatd will have to be recompiled. Notes: svn path=/head/; revision=26897
* Man the liferafts! Here comes the long awaited SMP -> -current merge!Peter Wemm1997-04-261-2/+2
| | | | | | | | | | | | | | | | | | | There are various options documented in i386/conf/LINT, there is more to come over the next few days. The kernel should run pretty much "as before" without the options to activate SMP mode. There are a handful of known "loose ends" that need to be fixed, but have been put off since the SMP kernel is in a moderately good condition at the moment. This commit is the result of the tinkering and testing over the last 14 months by many people. A special thanks to Steve Passe for implementing the APIC code! Notes: svn path=/head/; revision=25164
* Restore Bruce's original comment. It seems that "iff" = if and only if,Mike Pritchard1997-03-221-2/+2
| | | | | | | and is not a typo. It is used other places in the kernel, too. Notes: svn path=/head/; revision=24117
* Fix a typo in a comment of a recent commit.Mike Pritchard1997-03-221-2/+2
| | | | Notes: svn path=/head/; revision=24109
* Fixed some invalid (non-atomic) accesses to `time', mostly ones of theBruce Evans1997-03-221-1/+12
| | | | | | | | | form `tv = time'. Use a new function gettime(). The current version just forces atomicicity without fixing precision or efficiency bugs. Simplified some related valid accesses by using the central function. Notes: svn path=/head/; revision=24101
* Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are notPeter Wemm1997-02-221-1/+1
| | | | | | | ready for it yet. Notes: svn path=/head/; revision=22975
* This is the kernel Lite/2 commit. There are some requisite userlandJohn Dyson1997-02-101-1/+1
| | | | | | | | | | | | | | | | | | changes, so don't expect to be able to run the kernel as-is (very well) without the appropriate Lite/2 userland changes. The system boots and can mount UFS filesystems. Untested: ext2fs, msdosfs, NFS Known problems: Incorrect Berkeley ID strings in some files. Mount_std mounts will not work until the getfsent library routine is changed. Reviewed by: various people Submitted by: Jeffery Hsu <hsu@freebsd.org> Notes: svn path=/head/; revision=22521
* Make the long-awaited change from $Id$ to $FreeBSD$Jordan K. Hubbard1997-01-141-1/+1
| | | | | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise. Notes: svn path=/head/; revision=21673
* Update our kernel ntp code to the latest from David Mills. The main changeJohn Hay1996-12-301-127/+252
| | | | | | | | is the addition of the FLL code, which is used by the latest versions of xntpd. The kernel PPS code is also updated, although I can't test that yet. Notes: svn path=/head/; revision=21101
* Improved biasing of i586 clock by adjusting for hardclock() latency.Bruce Evans1996-10-251-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | I decided to do this for every hardclock() call instead of lazily in microtime(). The lazy method is simpler but has more overhead if microtime() is called a lot. CPU_THISTICKLEN() is now a no-op and should probably go away. Previously it did nothing directly but had the side effect of setting i586_last_tick for CPU_CLOCKUPDATE() and i586_avg_tick for debugging. CPU_CLOCKUPDATE() now uses a better method and i586_avg_tick is too much trouble to maintain. Reduced nesting of #includes in the usual case. Increased nesting of #includes when CLOCK_HAIR is defined. This is a kludge to get typedefs for inline functions only when the inline functions are used. Normally only kern_clock.c defines this. kern_clock.c can't include the i386 headers directly. Removed unused LOCORE support. Notes: svn path=/head/; revision=19172
* Don't include "opt_cpu.h" in <machine/clock.h>, since this breaks lkm's.Bruce Evans1996-10-101-1/+3
| | | | | | | | The change breaks kern_clock.c; fix that temporarily by including "opt_cpu.h" there. Notes: svn path=/head/; revision=18855
* Fixed resource usage integrals. They were too large by a factor ofBruce Evans1996-07-301-20/+21
| | | | | | | of profhz/stathz when profiling was enabled. Notes: svn path=/head/; revision=17342
* Unstaticize psratio and staticize profprocs. psratio needs to be exportedBruce Evans1996-06-231-5/+6
| | | | | | | to trap.c to fix user profiling. Notes: svn path=/head/; revision=16635
* Staticize.Poul-Henning Kamp1995-12-171-9/+10
| | | | | | | | | | | | | | | Unstaticize a function in scsi/scsi_base that was used, with an undocumented option. My last count on the LINT kernel shows: Total symbols: 3647 unref symbols: 463 undef symbols: 4 1 ref symbols: 1751 2 ref symbols: 485 Approaching the pain threshold now. Notes: svn path=/head/; revision=12913
* Untangled the vm.h include file spaghetti.David Greenman1995-12-071-1/+6
| | | | Notes: svn path=/head/; revision=12662