summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_tc.c
Commit message (Collapse)AuthorAgeFilesLines
* Including <sys/stdint.h> is (almost?) universally only to be able to usephk2003-03-181-1/+0
| | | | | %j in printfs, so put a newsted include in <sys/systm.h> where the printf prototype lives and save everybody else the trouble.
* Move timecounters notion of frequency to 64 bits.phk2003-01-291-3/+4
| | | | [WARNING: CPUs in the distant future may be closer than they appear!]
* Add sysctl kern.timecounter.nsetclock which indicates the number ofphk2003-01-251-0/+2
| | | | | | | | | | potential discontinuities in our UTC timescale. Applications can monitor this variable if they want to be informed about steps in the timescale. Slews (ntp and adjtime(2)) and frequency adjustments (ntp) will not increment this counter, only operations which set the clock. No attempt is made to classify size or direction of the step.
* Move a local variable to avoid the compiler warning about it being unused.phk2003-01-161-1/+2
|
* hardpps() wants the raw hardware counter value converted to nanoseconds.jhay2003-01-161-7/+7
|
* Explicitly have the timecounter init happen after the cpu_initclocks ispeter2003-01-061-1/+1
| | | | | | | | | called. Otherwise (depending on a non-deterministic sort), the timecounter code can be initialized before the clock rate has been set (on ia64) and it assumes hz = 100, rather than the real value of 1024. I'm not sure how much gets upset by this. Glanced at by: phk
* Export tc_tick with sysctl, not tick.phk2003-01-041-1/+1
| | | | Spotted by: bde
* Introduce a "time_uptime" global variable which holds the time since bootphk2002-11-011-0/+2
| | | | in seconds.
* Use strlcpy() instead of strncpy() to copy NUL terminated stringsrobert2002-10-171-2/+2
| | | | for safety and consistency.
* Do not employ timecounter hardware if our hz does not support theirphk2002-09-041-2/+10
| | | | correct rewinding.
* Give up on calling tc_ticktock() from a timeout, we have timeoutphk2002-09-041-4/+6
| | | | | | | | functions which run for several milliseconds at a time and getting in queue behind one or more of those makes us miss our rewind. Instead call it from hardclock() like we used to do, but retain the prescaler so we still cope with high HZ values.
* Use a semicolon at the end of a function-like macro invocation. Killsmarkm2002-07-151-1/+1
| | | | warnings and makes the visual style easier.
* Time counter stats are unsigned, advertise them to sysctl(8) that way.kbyanc2002-06-111-1/+1
| | | | | PR: (one small part of) 19720 Approved by: phk
* Mistyped and lost a '&' in previous commit.phk2002-05-301-1/+1
|
* Don't forget to factor in the boottime when we calculate PPS timestamps.phk2002-05-301-0/+1
| | | | Submitted by: Akira Watanabe <akira@myaw.ei.meisei-u.ac.jp>
* Initialize time_second to 1 instead of zero to pacify slightly bogus arp code.phk2002-05-031-6/+4
| | | | Various minor style fixes from BDE.
* kern_tc.c doesn't use <machine/psl.h>, and having this #include breakspeter2002-05-011-2/+0
| | | | other platforms.
* Brucifixion ? Yes, out that door, row on the left, one patch each.phk2002-04-301-87/+101
| | | | Many thanks to: bde
* Stylistic sweep through the timecounter code.phk2002-04-281-142/+222
| | | | Renovate comments.
* Don't screw up our uptime with historical dates.phk2002-04-281-1/+1
|
* Explain magic number.phk2002-04-271-2/+15
| | | | | | | Add magic date no explanation. Add a delta which was lost in transit yesterday which prevented other timecounters from actually being used.
* Make the dummy timecounter actually tick or we will never get anyhere.phk2002-04-271-1/+1
|
* Now that the private parts of timecounters are no longer being fingeredphk2002-04-261-143/+109
| | | | | | | | | | | | | by other bits of code, split struct timecounter into two. struct timecounter contains just the bits which pertains to the hardware counter and the reading of it. struct timehands (as in "the hands on a clock") contains all the ugly bit fidling stuff. Statically compile ten timehands. This commit is the functional part. A later cosmetic patch will rename various variables and fieldnames.
* Hide the private parts of timecounter from a couple of places that don'tphk2002-04-261-4/+10
| | | | really need to know the gory details.
* Simplify the RFC2783 and PPS_SYNC timestamp collection API.phk2002-04-261-16/+37
|
* Move the winding of timecounters out of hardclock and into a normalphk2002-04-261-1/+39
| | | | | | | | | timeout loop. Limit the rate at which we wind the timecounters to approx 1000 Hz. This limits the precision of the get{bin,nano,micro}[up]time(9) functions to roughly a millisecond.
* Various cleanup and sorting of clock reading functions. Add the twophk2002-04-261-71/+79
| | | | functions missing in the complete 12 function complement.
* Rename tco_setscales() and tco_delta() to use the same tc_ prefix asphk2002-04-261-11/+8
| | | | the rest of this file.
* Remove the tc_update() function. Any frequency change to thephk2002-04-261-6/+0
| | | | | | timecounter will be used starting at the next second, which is good enough for sysctl purposes. If better adjustment is needed the NTP PLL should be used.
* Improve the implementation of adjtime(2).phk2002-04-151-19/+4
| | | | | | | | | | | | | | | | | | | | | | | Apply the change as a continuous slew rather than as a series of discrete steps and make it possible to adjust arbitraryly huge amounts of time in either direction. In practice this is done by hooking into the same once-per-second loop as the NTP PLL and setting a suitable frequency offset deducting the amount slewed from the remainder. If the remaining delta is larger than 1 second we slew at 5000PPM (5msec/sec), for a delta less than a second we slew at 500PPM (500usec/sec) and for the last one second period we will slew at whatever rate (less than 500PPM) it takes to eliminate the delta entirely. The old implementation stepped the clock a number of microseconds every HZ to acheive the same effect, using the same rates of change. Eliminate the global variables tickadj, tickdelta and timedelta and their various use and initializations. This removes the most significant obstacle to running timecounter and NTP housekeeping from a timeout rather than hardclock.
* Get the magnitude of the NTP adjustment right.phk2002-03-281-3/+4
|
* Remove __P.alfred2002-03-191-2/+2
|
* Remove unused variable.phk2002-02-261-1/+0
|
* Add a generation number to timecounters and spin if it changes underphk2002-02-241-37/+62
| | | | | | | | | | | | our feet when we look inside timecounter structures. Make the "sync_other" code more robust by never overwriting the tc_next field. Add counters for the bin[up]time functions. Call tc_windup() in tc_init() and switch_timecounter() to make sure we all the fields set right.
* Use better scaling factor for NTPs correction.phk2002-02-221-1/+7
| | | | Explain the magic.
* Revise timercounters to use binary fixed point format internally.phk2002-02-071-108/+60
| | | | | | | | | | | | | | The binary format "bintime" is a 32.64 format, it will go to 64.64 when time_t does. The bintime format is available to consumers of time in the kernel, and is preferable where timeintervals needs to be accumulated. This change simplifies much of the magic math inside the timecounters and improves the frequency and time precision by a couple of bits. I have not been able to measure a performance difference which was not a tiny fraction of the standard deviation on the measurements.
* Let the number of timecounters follow hz, otherwise people withphk2002-02-051-2/+3
| | | | | | | | | | | | | HZ=BIGNUM will strain the assumptions behind timecounters to the point where they break. This may or may not help people seeing microuptime() backwards messages. Make the global timecounter variable volatile, it makes no difference in the code GCC generates, but it makes represents the intent correctly. Thanks to: jdp MFC after: 2 weeks
* Be more conservative about interrupt latency, it aint getting better it seems.phk2002-01-251-2/+2
|
* Remove a bogus #ifdef KTR stanza.phk2001-01-011-7/+0
| | | | Noticed by: Alexander Langer <alex@big.endian.de>
* Major update to the way synchronization is done in the kernel. Highlightsjasone2000-09-071-1/+8
| | | | | | | | | | | | | | | include: * Mutual exclusion is used instead of spl*(). See mutex(9). (Note: The alpha port is still in transition and currently uses both.) * Per-CPU idle processes. * Interrupts are run in their own separate kernel threads and can be preempted (i386 only). Partially contributed by: BSDi (BSD/OS) Submissions by (at least): cp, dfr, dillon, grog, jake, jhb, sheldonh
* Previous commit changing SYSCTL_HANDLER_ARGS violated KNF.phk2000-07-041-1/+1
| | | | Pointed out by: bde
* Style police catches up with rev 1.26 of src/sys/sys/sysctl.h:phk2000-07-031-1/+1
| | | | | | | | Sanitize SYSCTL_HANDLER_ARGS so that simplistic tools can grog our sources: -sysctl_vm_zone SYSCTL_HANDLER_ARGS +sysctl_vm_zone (SYSCTL_HANDLER_ARGS)
* Isolate the Timecounter internals in their own two files.phk2000-03-201-477/+54
| | | | | | | | | | | | | | | Make the public interface more systematically named. Remove the alternate method, it doesn't do any good, only ruins performance. Add counters to profile the usage of the 8 access functions. Apply the beer-ware to my code. The weird +/- counts are caused by two repocopies behind the scenes: kern/kern_clock.c -> kern/kern_tc.c sys/time.h -> sys/timetc.h (thanks peter!)
* Fix sign reversal in adjtime(2).phk2000-02-131-1/+1
| | | | Approved by: jkh
* Make adjtime(2) adjust boottime so it doesn't cause non-monotonousphk1999-12-081-2/+11
| | | | uptime.
* Fixed some comments in statclock(). The previous commit made it clearerbde1999-11-271-8/+8
| | | | that one comment was attached to null code.
* Moved scheduling-related code to kern_synch.c so that it is easier to fixbde1999-11-271-21/+1
| | | | | | | | and extend. The new function containing the code is named schedclock() as in NetBSD, but it has slightly different semantics (it already handles incrementation of p->p_cpticks, and it should handle any calling frequency). Agreed with in principle by: dufault
* #ifdef PPS_SYNC around "kapi" declaration to fix a -Wunused warning.peter1999-10-101-0/+2
|
* Update the PPSAPI to draft-mogul-pps-api-05.txt which is the latest.jhay1999-10-091-42/+54
| | | | | | NOTE: This will break building ntpd until ntpd has been upgraded to also support draft 05. People that want to build ntpd in the meantime can get patches from me.
* Moved the definition of `boottime' and its sysctl to the correct file.bde1999-09-131-0/+4
|
OpenPOWER on IntegriCloud