Deleted Added
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.

--- 22 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 * $Id$
40 */
41
42#include <sys/param.h>
43#include <sys/systm.h>
44#include <sys/dkstat.h>
45#include <sys/callout.h>
46#include <sys/kernel.h>
47#include <sys/proc.h>
48#include <sys/resourcevar.h>
49
50#include <machine/cpu.h>
51
52#ifdef GPROF
53#include <sys/gmon.h>
54#endif
55
56/*
57 * Clock handling routines.
58 *
59 * This code is written to operate with two timers that run independently of
60 * each other. The main clock, running hz times per second, is used to keep
61 * track of real time. The second timer handles kernel and user profiling,
62 * and does resource use estimation. If the second timer is programmable,
63 * it is randomized to avoid aliasing between the two clocks. For example,

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

252 *
253 * See AT&T BCI Driver Reference Manual for specification. This
254 * implementation differs from that one in that no identification
255 * value is returned from timeout, rather, the original arguments
256 * to timeout are used to identify entries for untimeout.
257 */
258void
259timeout(ftn, arg, ticks)
260 void (*ftn) __P((void *));
261 void *arg;
262 register int ticks;
263{
264 register struct callout *new, *p, *t;
265 register int s;
266
267 if (ticks <= 0)
268 ticks = 1;

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

297 /* Insert the new entry into the queue. */
298 p->c_next = new;
299 new->c_next = t;
300 splx(s);
301}
302
303void
304untimeout(ftn, arg)
305 void (*ftn) __P((void *));
306 void *arg;
307{
308 register struct callout *p, *t;
309 register int s;
310
311 s = splhigh();
312 for (p = &calltodo; (t = p->c_next) != NULL; p = t)
313 if (t->c_func == ftn && t->c_arg == arg) {

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

395 s = splstatclock();
396 psdiv = pscnt = 1;
397 setstatclockrate(stathz);
398 splx(s);
399 }
400 }
401}
402
403int dk_ndrive = DK_NDRIVE;
404
405/*
406 * Statistics clock. Grab profile sample, and if divider reaches 0,
407 * do process and kernel statistics.
408 */
409void
410statclock(frame)
411 register struct clockframe *frame;
412{

--- 118 unchanged lines hidden ---