aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_tc.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Commit the results of the typo hunt by Darren Pilgrim.Yaroslav Tykhiy2006-08-041-1/+1
| | | | | | | | | | | | | This change affects documentation and comments only, no real code involved. PR: misc/101245 Submitted by: Darren Pilgrim <darren pilgrim bitfreak org> Tested by: md5(1) MFC after: 1 week Notes: svn path=/head/; revision=160964
* Add a kern.timecounter.tc sysctl tree that contains the mask,David Malone2006-06-161-0/+40
| | | | | | | | | | | | frequency, quality and current value of each available time counter. At the moment all of these are read-only, but it might make sense to make some of these read-write in the future. MFC after: 3 months Notes: svn path=/head/; revision=159669
* Disable the "cputick increased..." message now that the dust has settled.Poul-Henning Kamp2006-03-151-1/+1
| | | | Notes: svn path=/head/; revision=156753
* Oops, forgot newline.Poul-Henning Kamp2006-03-091-1/+1
| | | | Notes: svn path=/head/; revision=156485
* silence cpu_tick calibration and notice only (under bootverbose)Poul-Henning Kamp2006-03-091-15/+8
| | | | | | | when the frequency increases. Notes: svn path=/head/; revision=156483
* Style nit.John Baldwin2006-03-071-2/+1
| | | | Notes: svn path=/head/; revision=156413
* Add missing cast.Poul-Henning Kamp2006-03-041-1/+1
| | | | Notes: svn path=/head/; revision=156271
* More detailed logging if timestepwarnings are enabled.Poul-Henning Kamp2006-03-041-5/+8
| | | | Notes: svn path=/head/; revision=156270
* Suffer a little bit of math every 16 second and tighten calibration ofPoul-Henning Kamp2006-03-021-12/+24
| | | | | | | cpu_ticks to the low side of PPM. Notes: svn path=/head/; revision=156205
* CPU time accounting speedup (step 2)Poul-Henning Kamp2006-02-111-5/+133
| | | | | | | | | | | | | | | | | | | | | | Keep accounting time (in per-cpu) cputicks and the statistics counts in the thread and summarize into struct proc when at context switch. Don't reach across CPUs in calcru(). Add code to calibrate the top speed of cpu_tickrate() for variable cpu_tick hardware (like TSC on power managed machines). Don't enforce monotonicity (at least for now) in calcru. While the calibrated cpu_tickrate ramps up it may not be true. Use 27MHz counter on i386/Geode. Use TSC on amd64 & i386 if present. Use tick counter on sparc64 Notes: svn path=/head/; revision=155534
* Modify the way we account for CPU time spent (step 1)Poul-Henning Kamp2006-02-071-0/+21
| | | | | | | | | | | | | | | | | | | Keep track of time spent by the cpu in various contexts in units of "cputicks" and scale to real-world microsec^H^H^H^H^H^H^H^Hclock_t only when somebody wants to inspect the numbers. For now "cputicks" are still derived from the current timecounter and therefore things should by definition remain sensible also on SMP machines. (The main reason for this first milestone commit is to verify that hypothesis.) On slower machines, the avoided multiplications to normalize timestams at every context switch, comes out as a 5-7% better score on the unixbench/context1 microbenchmark. On more modern hardware no change in performance is seen. Notes: svn path=/head/; revision=155444
* Start time_uptime with 1 instead of 0.Andre Oppermann2005-09-191-1/+1
| | | | | | | Discussed with: phk Notes: svn path=/head/; revision=150348
* Forward declaring static variables as extern is invalid ISO-C. Now thatDavid E. O'Brien2005-09-071-1/+1
| | | | | | | GCC can properly handle forward static declarations, do this properly. Notes: svn path=/head/; revision=149848
* s/ENOTTY/ENOIOCTL/Poul-Henning Kamp2005-03-261-1/+1
| | | | Notes: svn path=/head/; revision=144152
* Put on my peril sensitive sunglasses and add a flags field to the internalPeter Wemm2004-10-111-2/+17
| | | | | | | | | | | | | | | | | | | sysctl routines and state. Add some code to use it for signalling the need to downconvert a data structure to 32 bits on a 64 bit OS when requested by a 32 bit app. I tried to do this in a generic abi wrapper that intercepted the sysctl oid's, or looked up the format string etc, but it was a real can of worms that turned into a fragile mess before I even got it partially working. With this, we can now run 'sysctl -a' on a 32 bit sysctl binary and have it not abort. Things like netstat, ps, etc have a long way to go. This also fixes a bug in the kern.ps_strings and kern.usrstack hacks. These do matter very much because they are used by libc_r and other things. Notes: svn path=/head/; revision=136404
* Add some KASSERTS.Poul-Henning Kamp2004-08-141-0/+3
| | | | Notes: svn path=/head/; revision=133714
* Just because the timecounter reads the same value on two samplesPoul-Henning Kamp2004-03-041-4/+0
| | | | | | | after each other doesn't mean that nothing happened. Notes: svn path=/head/; revision=126600
* Write 100 times for tomorrow:Poul-Henning Kamp2004-01-221-2/+3
| | | | | | | "Always print time_t as %jd, you never know what width it has" Notes: svn path=/head/; revision=124842
* Add a sysctl (default: off) which enables a log(LOG_INFO...) warningPoul-Henning Kamp2004-01-211-10/+19
| | | | | | | if the clock is stepped. Notes: svn path=/head/; revision=124812
* Various minor details:Poul-Henning Kamp2003-11-131-8/+17
| | | | | | | | | | | Give the HZ/overflow check a 10% margin. Eliminate bogus newline. If timecounters have equal quality, prefer higher frequency. Some inspiration from: bde Notes: svn path=/head/; revision=122610
* Use the quality to disable timecounters for which we deem Hz too low.Poul-Henning Kamp2003-09-031-6/+10
| | | | Notes: svn path=/head/; revision=119716
* bde made a number of suggested improvements to the code. This commitWarner Losh2003-08-201-20/+17
| | | | | | | | | | | | | represents the pruely stylistic changes and should have no net impact on the rest of the code. bde's more substantive changes will follow in a separate commit once we've come to closure on them. Submitted by: bde Notes: svn path=/head/; revision=119183
* Fix an extreme edge case in leap second handling. We need to callWarner Losh2003-08-201-4/+6
| | | | | | | | | | | | | | ntp_update_second twice when we have a large step in case that step goes across a scheduled leap second. The only way this could happen would be if we didn't call tc_windup over the end of day on the day of a leap second, which would only happen if timeouts were delayed for seconds. While it is an edge case, it is an important one to get right for my employer. Sponsored by: Timing Solutions Corporation Notes: svn path=/head/; revision=119160
* Give timecounters a numeric quality field.Poul-Henning Kamp2003-08-161-8/+35
| | | | | | | | | | | | | | | | | | | A timecounter will be selected when registered if its quality is not negative and no less than the current timecounters. Add a sysctl to report all available timecounters and their qualities. Give the dummy timecounter a solid negative quality of minus a million. Give the i8254 zero and the ACPI 1000. The TSC gets 800, unless APM or SMP forces it negative. Other timecounters default to zero quality and thereby retain current selection behaviour. Notes: svn path=/head/; revision=118987
* Remove extra space.Maxime Henrion2003-08-121-1/+1
| | | | Notes: svn path=/head/; revision=118842
* typo fix in comment.Poul-Henning Kamp2003-07-021-1/+1
| | | | Notes: svn path=/head/; revision=117148
* Fix leap second processing by the kernel time keeping routines.Warner Losh2003-06-251-6/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before, we would add/subtract the leap second when the system had been up for an even multiple of days, rather than at the end of the day, as a leap second is defined (at least wrt ntp). We do this by calculating the notion of UTC earlier in the loop, and passing that to get it adjusted. Any adjustments that ntp_update_second makes to this time are then transferred to boot time. We can't pass it either the boot time or the uptime because their sum is what determines when a leap second is needed. This code adds an extra assignment and two extra compare in the typical case, which is as cheap as I could made it. I have confirmed with this code the kernel time does the correct thing for both positive and negative leap seconds. Since the ntp interface doesn't allow for +2 or -2, those cases can't be tested (and the folks in the know here say there will never be a +2s or -2s leap event, but rather two +1s or -1s leap events). There will very likely be no leap seconds for a while, given how the earth is speeding up and slowing down, so there will be plenty of time for this fix to propigate. UT1-UTC is currently at "about -0.4s" and decrementing by .1s every 8 months or so. 6 * 8 is 48 months, or 4 years. -stable has different code, but a similar bug that was introduced about the time of the last leap second, which is why nobody has noticed until now. MFC After: 3 weeks Reviewed by: phk "Furthermore, leap seconds must die." -- Cato the Elder Notes: svn path=/head/; revision=116841
* Use UTC rather than GMT to describe time scale. latter is obsolete.Warner Losh2003-06-231-2/+2
| | | | Notes: svn path=/head/; revision=116756
* Use __FBSDID().David E. O'Brien2003-06-111-2/+3
| | | | Notes: svn path=/head/; revision=116182
* Including <sys/stdint.h> is (almost?) universally only to be able to usePoul-Henning Kamp2003-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. Notes: svn path=/head/; revision=112367
* Move timecounters notion of frequency to 64 bits.Poul-Henning Kamp2003-01-291-3/+4
| | | | | | | [WARNING: CPUs in the distant future may be closer than they appear!] Notes: svn path=/head/; revision=110038
* Add sysctl kern.timecounter.nsetclock which indicates the number ofPoul-Henning Kamp2003-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. Notes: svn path=/head/; revision=109813
* Move a local variable to avoid the compiler warning about it being unused.Poul-Henning Kamp2003-01-161-1/+2
| | | | Notes: svn path=/head/; revision=109392
* hardpps() wants the raw hardware counter value converted to nanoseconds.John Hay2003-01-161-7/+7
| | | | Notes: svn path=/head/; revision=109391
* Explicitly have the timecounter init happen after the cpu_initclocks isPeter Wemm2003-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 Notes: svn path=/head/; revision=108755
* Export tc_tick with sysctl, not tick.Poul-Henning Kamp2003-01-041-1/+1
| | | | | | | Spotted by: bde Notes: svn path=/head/; revision=108671
* Introduce a "time_uptime" global variable which holds the time since bootPoul-Henning Kamp2002-11-011-0/+2
| | | | | | | in seconds. Notes: svn path=/head/; revision=106304
* Use strlcpy() instead of strncpy() to copy NUL terminated stringsRobert Drehmel2002-10-171-2/+2
| | | | | | | for safety and consistency. Notes: svn path=/head/; revision=105354
* Do not employ timecounter hardware if our hz does not support theirPoul-Henning Kamp2002-09-041-2/+10
| | | | | | | correct rewinding. Notes: svn path=/head/; revision=102933
* Give up on calling tc_ticktock() from a timeout, we have timeoutPoul-Henning Kamp2002-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. Notes: svn path=/head/; revision=102926
* Use a semicolon at the end of a function-like macro invocation. KillsMark Murray2002-07-151-1/+1
| | | | | | | warnings and makes the visual style easier. Notes: svn path=/head/; revision=100074
* Time counter stats are unsigned, advertise them to sysctl(8) that way.Kelly Yancey2002-06-111-1/+1
| | | | | | | | PR: (one small part of) 19720 Approved by: phk Notes: svn path=/head/; revision=98120
* Mistyped and lost a '&' in previous commit.Poul-Henning Kamp2002-05-301-1/+1
| | | | Notes: svn path=/head/; revision=97610
* Don't forget to factor in the boottime when we calculate PPS timestamps.Poul-Henning Kamp2002-05-301-0/+1
| | | | | | | Submitted by: Akira Watanabe <akira@myaw.ei.meisei-u.ac.jp> Notes: svn path=/head/; revision=97573
* Initialize time_second to 1 instead of zero to pacify slightly bogus arp code.Poul-Henning Kamp2002-05-031-6/+4
| | | | | | | Various minor style fixes from BDE. Notes: svn path=/head/; revision=95976
* kern_tc.c doesn't use <machine/psl.h>, and having this #include breaksPeter Wemm2002-05-011-2/+0
| | | | | | | other platforms. Notes: svn path=/head/; revision=95834
* Brucifixion ? Yes, out that door, row on the left, one patch each.Poul-Henning Kamp2002-04-301-87/+101
| | | | | | | Many thanks to: bde Notes: svn path=/head/; revision=95821
* Stylistic sweep through the timecounter code.Poul-Henning Kamp2002-04-281-142/+222
| | | | | | | Renovate comments. Notes: svn path=/head/; revision=95661
* Don't screw up our uptime with historical dates.Poul-Henning Kamp2002-04-281-1/+1
| | | | Notes: svn path=/head/; revision=95659
* Explain magic number.Poul-Henning Kamp2002-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. Notes: svn path=/head/; revision=95551