perfcounters: restructure x86 counter math

Impact: restructure code

Change counter math from absolute values to clear delta logic.

We try to extract elapsed deltas from the raw hw counter - and put
that into the generic counter.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
Ingo Molnar
2008-12-13 09:00:03 +01:00
parent 9b194e831f
commit ee06094f82
4 changed files with 137 additions and 178 deletions

View File

@@ -91,14 +91,16 @@ struct perf_counter_hw_event {
* struct hw_perf_counter - performance counter hardware details:
*/
struct hw_perf_counter {
#ifdef CONFIG_PERF_COUNTERS
u64 config;
unsigned long config_base;
unsigned long counter_base;
int nmi;
unsigned int idx;
u64 prev_count;
atomic64_t prev_count;
u64 irq_period;
s32 next_count;
atomic64_t period_left;
#endif
};
/*
@@ -140,17 +142,15 @@ enum perf_counter_active_state {
* struct perf_counter - performance counter kernel representation:
*/
struct perf_counter {
#ifdef CONFIG_PERF_COUNTERS
struct list_head list_entry;
struct list_head sibling_list;
struct perf_counter *group_leader;
const struct hw_perf_counter_ops *hw_ops;
enum perf_counter_active_state state;
#if BITS_PER_LONG == 64
atomic64_t count;
#else
atomic_t count32[2];
#endif
struct perf_counter_hw_event hw_event;
struct hw_perf_counter hw;
@@ -172,6 +172,7 @@ struct perf_counter {
struct perf_data *irqdata;
struct perf_data *usrdata;
struct perf_data data[2];
#endif
};
/**
@@ -220,8 +221,6 @@ extern void perf_counter_notify(struct pt_regs *regs);
extern void perf_counter_print_debug(void);
extern u64 hw_perf_save_disable(void);
extern void hw_perf_restore(u64 ctrl);
extern void atomic64_counter_set(struct perf_counter *counter, u64 val64);
extern u64 atomic64_counter_read(struct perf_counter *counter);
extern int perf_counter_task_disable(void);
extern int perf_counter_task_enable(void);