Пример #1
0
static void p4_check_ctrs(unsigned int const cpu, 
			  struct op_msrs const * const msrs,
			  struct pt_regs * const regs)
{
	unsigned long ctr, low, high, stag, real;
	int i;

	stag = get_stagger();

	for (i = 0; i < num_counters; ++i) {
		
		if (!sysctl.ctr[i].enabled) 
			continue;

		
		real = VIRT_CTR(stag, i);

		CCCR_READ(low, high, real);
 		CTR_READ(ctr, high, real);
		if (CCCR_OVF_P(low) || CTR_OVERFLOW_P(ctr)) {
			op_do_profile(cpu, instruction_pointer(regs), IRQ_ENABLED(regs), i);
 			CTR_WRITE(oprof_data[cpu].ctr_count[i], real);
			CCCR_CLEAR_OVF(low);
			CCCR_WRITE(low, high, real);
 			CTR_WRITE(oprof_data[cpu].ctr_count[i], real);
		}
	}

	
	apic_write(APIC_LVTPC, apic_read(APIC_LVTPC) & ~APIC_LVT_MASKED);
}
static void ppro_check_ctrs(uint const cpu, 
			    struct op_msrs const * const msrs,
			    struct pt_regs * const regs)
{
	ulong low, high;
	int i;
	for (i = 0 ; i < NUM_COUNTERS; ++i) {
		CTR_READ(low, high, msrs, i);
		if (CTR_OVERFLOWED(low)) {
			op_do_profile(cpu, instruction_pointer(regs), IRQ_ENABLED(regs), i);
			CTR_WRITE(oprof_data[cpu].ctr_count[i], msrs, i);
		}
	}
}
Пример #3
0
/**
 * Sleep until any of the signals in \a sigs or \a timeout ticks elapse.
 * If the timeout elapse a SIG_TIMEOUT is added to the received signal(s).
 * \return the signal(s) that have awoken the process.
 * \note Caller must check return value to check which signal awoke the process.
 */
sigmask_t sig_waitTimeout(sigmask_t sigs, ticks_t timeout)
{
	Timer t;
	sigmask_t res;
	cpu_flags_t flags;

	ASSERT(!sig_check(SIG_TIMEOUT));
	ASSERT(!(sigs & SIG_TIMEOUT));
	/* IRQ are needed to run timer */
	ASSERT(IRQ_ENABLED());

	timer_set_event_signal(&t, proc_current(), SIG_TIMEOUT);
	timer_setDelay(&t, timeout);
	timer_add(&t);
	res = sig_wait(SIG_TIMEOUT | sigs);

	IRQ_SAVE_DISABLE(flags);
	/* Remove timer if sigs occur before timer signal */
	if (!(res & SIG_TIMEOUT) && !sig_check(SIG_TIMEOUT))
		timer_abort(&t);
	IRQ_RESTORE(flags);
	return res;
}