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$
39 * $Id: kern_clock.c,v 1.3 1994/08/02 07:41:54 davidg Exp $
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/* Does anybody else really care about these? */
57struct callout *callfree, *callout, calltodo;
58int ncallout;
59
60/* Some of these don't belong here, but it's easiest to concentrate them. */
61long cp_time[CPUSTATES];
62long dk_seek[DK_NDRIVE];
63long dk_time[DK_NDRIVE];
64long dk_wds[DK_NDRIVE];
65long dk_wpms[DK_NDRIVE];
66long dk_xfer[DK_NDRIVE];
67
68int dk_busy;
69int dk_ndrive = DK_NDRIVE;
70
71long tk_cancc;
72long tk_nin;
73long tk_nout;
74long tk_rawcc;
75
76/*
77 * Clock handling routines.
78 *
79 * This code is written to operate with two timers that run independently of
80 * each other. The main clock, running hz times per second, is used to keep
81 * track of real time. The second timer handles kernel and user profiling,
82 * and does resource use estimation. If the second timer is programmable,
83 * it is randomized to avoid aliasing between the two clocks. For example,

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

272 *
273 * See AT&T BCI Driver Reference Manual for specification. This
274 * implementation differs from that one in that no identification
275 * value is returned from timeout, rather, the original arguments
276 * to timeout are used to identify entries for untimeout.
277 */
278void
279timeout(ftn, arg, ticks)
260 void (*ftn) __P((void *));
280 timeout_t ftn;
281 void *arg;
282 register int ticks;
283{
284 register struct callout *new, *p, *t;
285 register int s;
286
287 if (ticks <= 0)
288 ticks = 1;

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

317 /* Insert the new entry into the queue. */
318 p->c_next = new;
319 new->c_next = t;
320 splx(s);
321}
322
323void
324untimeout(ftn, arg)
305 void (*ftn) __P((void *));
325 timeout_t ftn;
326 void *arg;
327{
328 register struct callout *p, *t;
329 register int s;
330
331 s = splhigh();
332 for (p = &calltodo; (t = p->c_next) != NULL; p = t)
333 if (t->c_func == ftn && t->c_arg == arg) {

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

415 s = splstatclock();
416 psdiv = pscnt = 1;
417 setstatclockrate(stathz);
418 splx(s);
419 }
420 }
421}
422
403int dk_ndrive = DK_NDRIVE;
404
423/*
424 * Statistics clock. Grab profile sample, and if divider reaches 0,
425 * do process and kernel statistics.
426 */
427void
428statclock(frame)
429 register struct clockframe *frame;
430{

--- 118 unchanged lines hidden ---