Example #1
0
/* Reconfigure and restart event timers after configuration changes. */
static void
cpu_restartclocks(void)
{

	/* Stop all event timers. */
	timertest = 0;
	if (timer1hz) {
		timer1hz = 0;
		configtimer(0);
	}
	if (timer[1] && timer2hz) {
		timer2hz = 0;
		configtimer(1);
	}
	/* Calculate new event timers parameters. */
	if (timer[1] == NULL) {
		timer1hz = hz * singlemul;
		while (timer1hz < (profiling_on ? profhz : stathz))
			timer1hz += hz;
		timer2hz = 0;
	} else {
		timer1hz = hz;
		timer2hz = profiling_on ? profhz : stathz;
		timer2hz = round_freq(timer[1], timer2hz);
	}
	timer1hz = round_freq(timer[0], timer1hz);
	printf("Starting kernel event timers: %s @ %dHz, %s @ %dHz\n",
	    timer[0]->et_name, timer1hz,
	    timer[1] ? timer[1]->et_name : "NONE", timer2hz);
	/* Restart event timers. */
	FREQ2BT(timer1hz, &timerperiod[0]);
	configtimer(0);
	if (timer[1]) {
		timerticks[0] = 0;
		timerticks[1] = 0;
		FREQ2BT(timer2hz, &timerperiod[1]);
		configtimer(1);
		timertest = 1;
	}
}
Example #2
0
struct vpmtmr *
vpmtmr_init(struct vm *vm)
{
	struct vpmtmr *vpmtmr;
	struct bintime bt;

	vpmtmr = malloc(sizeof(struct vpmtmr), M_VPMTMR, M_WAITOK | M_ZERO);
	vpmtmr->baseuptime = sbinuptime();
	vpmtmr->baseval = 0;

	FREQ2BT(PMTMR_FREQ, &bt);
	vpmtmr->freq_sbt = bttosbt(bt);

	return (vpmtmr);
}
Example #3
0
struct vpmtmr *
vpmtmr_init(UNUSED struct vm *vm)
{
	struct vpmtmr *vpmtmr;
	struct bintime bt;

	vpmtmr = malloc(sizeof(struct vpmtmr));
	assert(vpmtmr);
	bzero(vpmtmr, sizeof(struct vpmtmr));
	vpmtmr->baseuptime = sbinuptime();
	vpmtmr->baseval = 0;

	FREQ2BT(PMTMR_FREQ, &bt);
	vpmtmr->freq_sbt = bttosbt(bt);

	return (vpmtmr);
}