#include <linux/module.h>
#include <linux/slab.h>
#include <linux/perf_event.h>
#include <asm/cpu_device_id.h>
#include "../perf_event.h"
#define AMD_POWER_EVENT_MASK …
#define AMD_POWER_EVENTSEL_PKG …
static unsigned int cpu_pwr_sample_ratio;
static u64 max_cu_acc_power;
static struct pmu pmu_class;
static cpumask_t cpu_mask;
static void event_update(struct perf_event *event)
{ … }
static void __pmu_event_start(struct perf_event *event)
{ … }
static void pmu_event_start(struct perf_event *event, int mode)
{ … }
static void pmu_event_stop(struct perf_event *event, int mode)
{ … }
static int pmu_event_add(struct perf_event *event, int mode)
{ … }
static void pmu_event_del(struct perf_event *event, int flags)
{ … }
static int pmu_event_init(struct perf_event *event)
{ … }
static void pmu_event_read(struct perf_event *event)
{ … }
static ssize_t
get_attr_cpumask(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR(cpumask, S_IRUGO, get_attr_cpumask, NULL);
static struct attribute *pmu_attrs[] = …;
static struct attribute_group pmu_attr_group = …;
EVENT_ATTR_STR(power-pkg, power_pkg, "event=0x01");
EVENT_ATTR_STR(power-pkg.unit, power_pkg_unit, "mWatts");
EVENT_ATTR_STR(power-pkg.scale, power_pkg_scale, "1.000000e-3");
static struct attribute *events_attr[] = …;
static struct attribute_group pmu_events_group = …;
PMU_FORMAT_ATTR(…);
static struct attribute *formats_attr[] = …;
static struct attribute_group pmu_format_group = …;
static const struct attribute_group *attr_groups[] = …;
static struct pmu pmu_class = …;
static int power_cpu_exit(unsigned int cpu)
{ … }
static int power_cpu_init(unsigned int cpu)
{ … }
static const struct x86_cpu_id cpu_match[] = …;
static int __init amd_power_pmu_init(void)
{ … }
module_init(…) …;
static void __exit amd_power_pmu_exit(void)
{ … }
module_exit(amd_power_pmu_exit);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;