static void ebs_overflow_handler(struct perf_event *event, struct perf_sample_data *data, struct pt_regs *regs) #endif { unsigned int value, delta, cpu = smp_processor_id(), buftype = EVENT_BUF; if (event != per_cpu(pevent, cpu)) return; if (buffer_check_space(cpu, buftype, 5 * MAXSIZE_PACK32 + MAXSIZE_PACK64)) { value = local64_read(&event->count); delta = value - per_cpu(prev_value, cpu); per_cpu(prev_value, cpu) = value; // Counters header gator_buffer_write_packed_int(cpu, buftype, MESSAGE_COUNTERS); // type gator_buffer_write_packed_int64(cpu, buftype, gator_get_time()); // time // Output counter gator_buffer_write_packed_int(cpu, buftype, 2); // length gator_buffer_write_packed_int(cpu, buftype, per_cpu(key, cpu)); // key gator_buffer_write_packed_int(cpu, buftype, delta); // delta // End Counters, length of zero gator_buffer_write_packed_int(cpu, buftype, 0); } // Output backtrace if (buffer_check_space(cpu, buftype, gator_backtrace_depth * 2 * MAXSIZE_PACK32)) gator_add_sample(cpu, buftype, regs); // Check and commit; commit is set to occur once buffer is 3/4 full buffer_check(cpu, buftype); }
static void ebs_overflow_handler(struct perf_event *event, struct perf_sample_data *data, struct pt_regs *regs) #endif { int cpu = smp_processor_id(); if (event != per_cpu(pevent_ebs, cpu)) return; // Output backtrace gator_add_sample(cpu, BACKTRACE_BUF, regs); // Collect counters collect_counters(); }
static irqreturn_t armv7_pmnc_interrupt(int irq, void *arg) { unsigned int cnt, cpu = smp_processor_id(), buftype = EVENT_BUF; struct pt_regs * const regs = get_irq_regs(); u32 flags; // Stop irq generation armv7_pmnc_write(armv7_pmnc_read() & ~PMNC_E); // Get and reset overflow status flags flags = armv7_pmnc_reset_interrupt(); // Counters header gator_buffer_write_packed_int(cpu, buftype, MESSAGE_COUNTERS); // type gator_buffer_write_packed_int64(cpu, buftype, gator_get_time()); // time // Cycle counter if (flags & (1 << 31)) { int value = armv7_ccnt_read(pmnc_count[CCNT]); // overrun gator_buffer_write_packed_int(cpu, buftype, 2); // length gator_buffer_write_packed_int(cpu, buftype, pmnc_key[CCNT]); // key gator_buffer_write_packed_int(cpu, buftype, value); // value } // PMNC counters for (cnt = CNT0; cnt < CNTMAX; cnt++) { if (flags & (1 << (cnt - CNT0))) { int value = armv7_cntn_read(cnt, pmnc_count[cnt]); // overrun gator_buffer_write_packed_int(cpu, buftype, 2); // length gator_buffer_write_packed_int(cpu, buftype, pmnc_key[cnt]); // key gator_buffer_write_packed_int(cpu, buftype, value); // value } } // End Counters, length of zero gator_buffer_write_packed_int(cpu, buftype, 0); // Output backtrace gator_add_sample(cpu, buftype, regs); // Check and commit; commit is set to occur once buffer is 3/4 full event_buffer_check(cpu); // Allow irq generation armv7_pmnc_write(armv7_pmnc_read() | PMNC_E); return IRQ_HANDLED; }