Deleted Added
sdiff udiff text old ( 57182 ) new ( 58377 )
full compact
1/*-
2 * Copyright (c) 1982, 1986, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.
9 *

--- 21 unchanged lines hidden (view full) ---

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)kern_clock.c 8.5 (Berkeley) 1/21/94
39 * $FreeBSD: head/sys/kern/kern_clock.c 58377 2000-03-20 14:09:06Z phk $
40 */
41
42#include "opt_ntp.h"
43
44#include <sys/param.h>
45#include <sys/systm.h>
46#include <sys/dkstat.h>
47#include <sys/callout.h>
48#include <sys/kernel.h>
49#include <sys/proc.h>
50#include <sys/malloc.h>
51#include <sys/resourcevar.h>
52#include <sys/signalvar.h>
53#include <sys/timetc.h>
54#include <sys/timepps.h>
55#include <vm/vm.h>
56#include <sys/lock.h>
57#include <vm/pmap.h>
58#include <vm/vm_map.h>
59#include <sys/sysctl.h>
60
61#include <machine/cpu.h>
62#include <machine/limits.h>
63
64#ifdef GPROF
65#include <sys/gmon.h>
66#endif
67
68#if defined(SMP) && defined(BETTER_CLOCK)
69#include <machine/smp.h>
70#endif
71
72static void initclocks __P((void *dummy));
73SYSINIT(clocks, SI_SUB_CLOCKS, SI_ORDER_FIRST, initclocks, NULL)
74
75/* Some of these don't belong here, but it's easiest to concentrate them. */
76#if defined(SMP) && defined(BETTER_CLOCK)
77long cp_time[CPUSTATES];
78#else
79static long cp_time[CPUSTATES];
80#endif
81
82long tk_cancc;
83long tk_nin;
84long tk_nout;
85long tk_rawcc;
86
87/*
88 * Clock handling routines.
89 *
90 * This code is written to operate with two timers that run independently of
91 * each other.
92 *
93 * The main timer, running hz times per second, is used to trigger interval
94 * timers, timeouts and rescheduling as needed.
95 *

--- 84 unchanged lines hidden (view full) ---

180#endif
181
182 /*
183 * If no separate statistics clock is available, run it from here.
184 */
185 if (stathz == 0)
186 statclock(frame);
187
188 tc_windup();
189 ticks++;
190
191 /*
192 * Process callouts at a very low cpu priority, so we don't keep the
193 * relatively high clock interrupt priority any longer than necessary.
194 */
195 if (TAILQ_FIRST(&callwheel[ticks & callwheelmask]) != NULL) {
196 if (CLKF_BASEPRI(frame)) {

--- 230 unchanged lines hidden (view full) ---

427 clkinfo.tickadj = tickadj;
428 clkinfo.profhz = profhz;
429 clkinfo.stathz = stathz ? stathz : hz;
430 return (sysctl_handle_opaque(oidp, &clkinfo, sizeof clkinfo, req));
431}
432
433SYSCTL_PROC(_kern, KERN_CLOCKRATE, clockrate, CTLTYPE_STRUCT|CTLFLAG_RD,
434 0, 0, sysctl_kern_clockrate, "S,clockinfo","");