/* * \brief Initialize measuring for performance analysis. * * An overflow will be registered and the counter will set such that this * overflow occures every ctr counter steps. */ void perfmon_measure_start(uint8_t event, uint8_t umask, uint8_t counter_id, bool kernel, uint64_t ctr) { // Activate APIC interrupts for overflow if init successful /* if(ctr!=0) { */ /* if(perfmon_amd || perfmon_intel) { */ /* printf("Starting APIC perf interrupt\n"); */ /* apic_perfcnt_init(); */ /* } */ /* } */ if(perfmon_amd) { perfmon_amd_measure_write(ctr*-1, 0); perfmon_amd_measure_start(event, umask, kernel, counter_id, ctr!=0); } // Activate performance measurement for Intel if(perfmon_intel) { printf("Starting perfmon on Intel...\n"); perfmon_intel_measure_write(ctr*-1); perfmon_intel_measure_start(event, umask, kernel, counter_id, ctr!=0); } perfmon_cntr_init = ctr; perfmon_event = event; perfmon_umask = umask; perfmon_kernel = kernel; perfmon_counter_id = counter_id; perfmon_ctr = ctr; timing_apic_timer_set_ms(1); mycnt_incr = 1; }
/* * Re-Initialize counter after overflow. * This function is called from the interrupt processing. */ void perfmon_measure_reset(void) { if(perfmon_amd) { perfmon_amd_measure_write(perfmon_cntr_init*-1, 0); } if(perfmon_intel) { perfmon_intel_reset(); perfmon_intel_measure_write(perfmon_cntr_init*-1); perfmon_intel_measure_start(perfmon_event, perfmon_umask, perfmon_kernel, perfmon_counter_id, perfmon_ctr!=0); } }
void perfmon_measure_write(uint8_t counter_id, uint64_t val) { if(perfmon_amd) { perfmon_amd_measure_write(val, counter_id); } if(perfmon_intel) { perfmon_intel_measure_write(val); } }
/* * \brief Initialize measuring for performance analysis. * * An overflow will be registered and the counter will set such that this * overflow occures every ctr counter steps. */ void perfmon_measure_start(uint8_t event, uint8_t umask, uint8_t counter_id, bool kernel, uint64_t ctr) { // Activate APIC interrupts for overflow if init successful if(ctr!=0) { if(perfmon_amd || perfmon_intel) { apic_perfcnt_init(); } } // Activate performance measurement for Intel if(perfmon_amd) { perfmon_amd_measure_write(ctr*-1, 0); perfmon_amd_measure_start(event, umask, kernel, counter_id, ctr!=0); perfmon_cntr_init = ctr; } }
/* * Re-Initialize counter after overflow. * This function is called from the interrupt processing. */ void perfmon_measure_reset(void) { if(perfmon_amd) { perfmon_amd_measure_write(perfmon_cntr_init*-1, 0); } }