Exemple #1
0
/*
 * Initialize clock frequencies and start both clocks running.
 */
void
initclocks(void)
{
	int i;

	softclock_si = softintr_establish(IPL_SOFTCLOCK, softclock, NULL);
	if (softclock_si == NULL)
		panic("initclocks: unable to register softclock intr");

	ticks = INT_MAX - (15 * 60 * hz);

	/*
	 * Set divisors to 1 (normal case) and let the machine-specific
	 * code do its bit.
	 */
	psdiv = pscnt = 1;
	cpu_initclocks();

	/*
	 * Compute profhz/stathz, and fix profhz if needed.
	 */
	i = stathz ? stathz : hz;
	if (profhz == 0)
		profhz = i;
	psratio = profhz / i;

	/* For very large HZ, ensure that division by 0 does not occur later */
	if (tickadj == 0)
		tickadj = 1;

	inittimecounter();
}
Exemple #2
0
/*
 * Initialize clock frequencies and start both clocks running.
 */
void
initclocks(void)
{
	int i;

	/*
	 * Set divisors to 1 (normal case) and let the machine-specific
	 * code do its bit.
	 */
	psdiv = 1;
	/*
	 * provide minimum default time counter
	 * will only run at interrupt resolution
	 */
	intr_timecounter.tc_frequency = hz;
	tc_init(&intr_timecounter);
	cpu_initclocks();

	/*
	 * Compute profhz and stathz, fix profhz if needed.
	 */
	i = stathz ? stathz : hz;
	if (profhz == 0)
		profhz = i;
	psratio = profhz / i;
	if (schedhz == 0) {
		/* 16Hz is best */
		hardscheddiv = hz / 16;
		if (hardscheddiv <= 0)
			panic("hardscheddiv");
	}

}
Exemple #3
0
int clock_init(time_t base) {
  /* 100 ticks per second */
  si->si_rate = 10000; 
  startrtclock(); /* init the scheduler's clock (not actually part of
		     the real time clock), and check the BIOS diagnostic
		     byte that's part of the RTC's nvram */
  cpu_initclocks(); /* init the real time clock's periodic interrupt */
  inittodr(base); /* read the real time clock's time of day */
  return 0;
}
Exemple #4
0
/*
 * Initialize clock frequencies and start both clocks running.
 */
void
initclocks(void)
{
	static struct sysctllog *clog;
	int i;

	/*
	 * Set divisors to 1 (normal case) and let the machine-specific
	 * code do its bit.
	 */
	psdiv = 1;
	/*
	 * provide minimum default time counter
	 * will only run at interrupt resolution
	 */
	intr_timecounter.tc_frequency = hz;
	tc_init(&intr_timecounter);
	cpu_initclocks();

	/*
	 * Compute profhz and stathz, fix profhz if needed.
	 */
	i = stathz ? stathz : hz;
	if (profhz == 0)
		profhz = i;
	psratio = profhz / i;
	if (schedhz == 0) {
		/* 16Hz is best */
		hardscheddiv = hz / 16;
		if (hardscheddiv <= 0)
			panic("hardscheddiv");
	}

	sysctl_createv(&clog, 0, NULL, NULL,
		       CTLFLAG_PERMANENT,
		       CTLTYPE_STRUCT, "clockrate",
		       SYSCTL_DESCR("Kernel clock rates"),
		       sysctl_kern_clockrate, 0, NULL,
		       sizeof(struct clockinfo),
		       CTL_KERN, KERN_CLOCKRATE, CTL_EOL);
	sysctl_createv(&clog, 0, NULL, NULL,
		       CTLFLAG_PERMANENT,
		       CTLTYPE_INT, "hardclock_ticks",
		       SYSCTL_DESCR("Number of hardclock ticks"),
		       NULL, 0, &hardclock_ticks, sizeof(hardclock_ticks),
		       CTL_KERN, KERN_HARDCLOCK_TICKS, CTL_EOL);
}
Exemple #5
0
/*
 * Initialize clock frequencies and start both clocks running.
 */
void
initclocks()
{
    register int i;

    /*
     * Set divisors to 1 (normal case) and let the machine-specific
     * code do its bit.
     */
    psdiv = pscnt = 1;
    cpu_initclocks();

    /*
     * Compute profhz/stathz, and fix profhz if needed.
     */
    i = stathz ? stathz : hz;
    if (profhz == 0)
        profhz = i;
    psratio = profhz / i;

#ifdef NTP
    switch (hz) {
    case 60:
    case 64:
        shifthz = SHIFT_SCALE - 6;
        break;
    case 96:
    case 100:
    case 128:
        shifthz = SHIFT_SCALE - 7;
        break;
    case 256:
        shifthz = SHIFT_SCALE - 8;
        break;
    case 512:
        shifthz = SHIFT_SCALE - 9;
        break;
    case 1000:
    case 1024:
        shifthz = SHIFT_SCALE - 10;
        break;
    default:
        panic("weird hz");
    }
#endif
}
Exemple #6
0
/*
 * Initialize clock frequencies and start both clocks running.
 */
void
initclocks()
{
	register int i;

	/*
	 * Set divisors to 1 (normal case) and let the machine-specific
	 * code do its bit.
	 */
	psdiv = pscnt = 1;
	cpu_initclocks();

	/*
	 * Compute profhz/stathz, and fix profhz if needed.
	 */
	i = stathz ? stathz : hz;
	if (profhz == 0)
		profhz = i;
	psratio = profhz / i;

}