static void perf_adjust_freq(struct perf_counter_context *ctx)
{
struct perf_counter *counter;
- u64 interrupts, irq_period;
+ u64 interrupts, sample_period;
u64 events, period;
s64 delta;
interrupts = 2*sysctl_perf_counter_limit/HZ;
}
- if (!counter->hw_event.freq || !counter->hw_event.irq_freq)
+ if (!counter->hw_event.freq || !counter->hw_event.sample_freq)
continue;
- events = HZ * interrupts * counter->hw.irq_period;
- period = div64_u64(events, counter->hw_event.irq_freq);
+ events = HZ * interrupts * counter->hw.sample_period;
+ period = div64_u64(events, counter->hw_event.sample_freq);
- delta = (s64)(1 + period - counter->hw.irq_period);
+ delta = (s64)(1 + period - counter->hw.sample_period);
delta >>= 1;
- irq_period = counter->hw.irq_period + delta;
+ sample_period = counter->hw.sample_period + delta;
- if (!irq_period)
- irq_period = 1;
+ if (!sample_period)
+ sample_period = 1;
- perf_log_period(counter, irq_period);
+ perf_log_period(counter, sample_period);
- counter->hw.irq_period = irq_period;
+ counter->hw.sample_period = sample_period;
}
spin_unlock(&ctx->lock);
}
int nmi, struct pt_regs *regs, u64 addr)
{
int ret;
- u64 record_type = counter->hw_event.record_type;
+ u64 sample_type = counter->hw_event.sample_type;
struct perf_output_handle handle;
struct perf_event_header header;
u64 ip;
header.misc = PERF_EVENT_MISC_OVERFLOW;
header.misc |= perf_misc_flags(regs);
- if (record_type & PERF_RECORD_IP) {
+ if (sample_type & PERF_SAMPLE_IP) {
ip = perf_instruction_pointer(regs);
- header.type |= PERF_RECORD_IP;
+ header.type |= PERF_SAMPLE_IP;
header.size += sizeof(ip);
}
- if (record_type & PERF_RECORD_TID) {
+ if (sample_type & PERF_SAMPLE_TID) {
/* namespace issues */
tid_entry.pid = perf_counter_pid(counter, current);
tid_entry.tid = perf_counter_tid(counter, current);
- header.type |= PERF_RECORD_TID;
+ header.type |= PERF_SAMPLE_TID;
header.size += sizeof(tid_entry);
}
- if (record_type & PERF_RECORD_TIME) {
+ if (sample_type & PERF_SAMPLE_TIME) {
/*
* Maybe do better on x86 and provide cpu_clock_nmi()
*/
time = sched_clock();
- header.type |= PERF_RECORD_TIME;
+ header.type |= PERF_SAMPLE_TIME;
header.size += sizeof(u64);
}
- if (record_type & PERF_RECORD_ADDR) {
- header.type |= PERF_RECORD_ADDR;
+ if (sample_type & PERF_SAMPLE_ADDR) {
+ header.type |= PERF_SAMPLE_ADDR;
header.size += sizeof(u64);
}
- if (record_type & PERF_RECORD_CONFIG) {
- header.type |= PERF_RECORD_CONFIG;
+ if (sample_type & PERF_SAMPLE_CONFIG) {
+ header.type |= PERF_SAMPLE_CONFIG;
header.size += sizeof(u64);
}
- if (record_type & PERF_RECORD_CPU) {
- header.type |= PERF_RECORD_CPU;
+ if (sample_type & PERF_SAMPLE_CPU) {
+ header.type |= PERF_SAMPLE_CPU;
header.size += sizeof(cpu_entry);
cpu_entry.cpu = raw_smp_processor_id();
}
- if (record_type & PERF_RECORD_GROUP) {
- header.type |= PERF_RECORD_GROUP;
+ if (sample_type & PERF_SAMPLE_GROUP) {
+ header.type |= PERF_SAMPLE_GROUP;
header.size += sizeof(u64) +
counter->nr_siblings * sizeof(group_entry);
}
- if (record_type & PERF_RECORD_CALLCHAIN) {
+ if (sample_type & PERF_SAMPLE_CALLCHAIN) {
callchain = perf_callchain(regs);
if (callchain) {
callchain_size = (1 + callchain->nr) * sizeof(u64);
- header.type |= PERF_RECORD_CALLCHAIN;
+ header.type |= PERF_SAMPLE_CALLCHAIN;
header.size += callchain_size;
}
}
perf_output_put(&handle, header);
- if (record_type & PERF_RECORD_IP)
+ if (sample_type & PERF_SAMPLE_IP)
perf_output_put(&handle, ip);
- if (record_type & PERF_RECORD_TID)
+ if (sample_type & PERF_SAMPLE_TID)
perf_output_put(&handle, tid_entry);
- if (record_type & PERF_RECORD_TIME)
+ if (sample_type & PERF_SAMPLE_TIME)
perf_output_put(&handle, time);
- if (record_type & PERF_RECORD_ADDR)
+ if (sample_type & PERF_SAMPLE_ADDR)
perf_output_put(&handle, addr);
- if (record_type & PERF_RECORD_CONFIG)
+ if (sample_type & PERF_SAMPLE_CONFIG)
perf_output_put(&handle, counter->hw_event.config);
- if (record_type & PERF_RECORD_CPU)
+ if (sample_type & PERF_SAMPLE_CPU)
perf_output_put(&handle, cpu_entry);
/*
- * XXX PERF_RECORD_GROUP vs inherited counters seems difficult.
+ * XXX PERF_SAMPLE_GROUP vs inherited counters seems difficult.
*/
- if (record_type & PERF_RECORD_GROUP) {
+ if (sample_type & PERF_SAMPLE_GROUP) {
struct perf_counter *leader, *sub;
u64 nr = counter->nr_siblings;
}
/*
- * Log irq_period changes so that analyzing tools can re-normalize the
+ * Log sample_period changes so that analyzing tools can re-normalize the
* event flow.
*/
.period = period,
};
- if (counter->hw.irq_period == period)
+ if (counter->hw.sample_period == period)
return;
ret = perf_output_begin(&handle, counter, sizeof(freq_event), 0, 0);
{
struct hw_perf_counter *hwc = &counter->hw;
s64 left = atomic64_read(&hwc->period_left);
- s64 period = hwc->irq_period;
+ s64 period = hwc->sample_period;
if (unlikely(left <= -period)) {
left = period;
ret = HRTIMER_NORESTART;
}
- period = max_t(u64, 10000, counter->hw.irq_period);
+ period = max_t(u64, 10000, counter->hw.sample_period);
hrtimer_forward_now(hrtimer, ns_to_ktime(period));
return ret;
{
int neg = atomic64_add_negative(nr, &counter->hw.count);
- if (counter->hw.irq_period && !neg && regs)
+ if (counter->hw.sample_period && !neg && regs)
perf_swcounter_overflow(counter, nmi, regs, addr);
}
atomic64_set(&hwc->prev_count, cpu_clock(cpu));
hrtimer_init(&hwc->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
hwc->hrtimer.function = perf_swcounter_hrtimer;
- if (hwc->irq_period) {
- u64 period = max_t(u64, 10000, hwc->irq_period);
+ if (hwc->sample_period) {
+ u64 period = max_t(u64, 10000, hwc->sample_period);
__hrtimer_start_range_ns(&hwc->hrtimer,
ns_to_ktime(period), 0,
HRTIMER_MODE_REL, 0);
static void cpu_clock_perf_counter_disable(struct perf_counter *counter)
{
- if (counter->hw.irq_period)
+ if (counter->hw.sample_period)
hrtimer_cancel(&counter->hw.hrtimer);
cpu_clock_perf_counter_update(counter);
}
atomic64_set(&hwc->prev_count, now);
hrtimer_init(&hwc->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
hwc->hrtimer.function = perf_swcounter_hrtimer;
- if (hwc->irq_period) {
- u64 period = max_t(u64, 10000, hwc->irq_period);
+ if (hwc->sample_period) {
+ u64 period = max_t(u64, 10000, hwc->sample_period);
__hrtimer_start_range_ns(&hwc->hrtimer,
ns_to_ktime(period), 0,
HRTIMER_MODE_REL, 0);
static void task_clock_perf_counter_disable(struct perf_counter *counter)
{
- if (counter->hw.irq_period)
+ if (counter->hw.sample_period)
hrtimer_cancel(&counter->hw.hrtimer);
task_clock_perf_counter_update(counter, counter->ctx->time);
return NULL;
counter->destroy = tp_perf_counter_destroy;
- counter->hw.irq_period = counter->hw_event.irq_period;
+ counter->hw.sample_period = counter->hw_event.sample_period;
return &perf_ops_generic;
}
pmu = NULL;
hwc = &counter->hw;
- if (hw_event->freq && hw_event->irq_freq)
- hwc->irq_period = div64_u64(TICK_NSEC, hw_event->irq_freq);
+ if (hw_event->freq && hw_event->sample_freq)
+ hwc->sample_period = div64_u64(TICK_NSEC, hw_event->sample_freq);
else
- hwc->irq_period = hw_event->irq_period;
+ hwc->sample_period = hw_event->sample_period;
/*
- * we currently do not support PERF_RECORD_GROUP on inherited counters
+ * we currently do not support PERF_SAMPLE_GROUP on inherited counters
*/
- if (hw_event->inherit && (hw_event->record_type & PERF_RECORD_GROUP))
+ if (hw_event->inherit && (hw_event->sample_type & PERF_SAMPLE_GROUP))
goto done;
if (perf_event_raw(hw_event)) {