diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-08-23 15:51:21 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-08-23 15:53:01 +0100 |
commit | 9574cb1a3de0dfe45c59420e2cb9a74fc23baecc (patch) | |
tree | aa474dcec21c0f00196394e6d78a4e97bd9bce06 /overlay/power.c | |
parent | fd88db77cccf5d8d9be133dfcb3cdc3ff3f219f3 (diff) |
overlay: Search for right debugfs path
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'overlay/power.c')
-rw-r--r-- | overlay/power.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/overlay/power.c b/overlay/power.c index aecf54e8..e69b1a19 100644 --- a/overlay/power.c +++ b/overlay/power.c @@ -31,6 +31,7 @@ #include <errno.h> #include "power.h" +#include "debugfs.h" /* XXX Is this exposed through RAPL? */ @@ -41,7 +42,8 @@ int power_init(struct power *power) memset(power, 0, sizeof(*power)); - fd = open("/sys/kernel/debug/dri/0/i915_energy_uJ", 0); + sprintf(buf, "%s/i915_energy_uJ", debugfs_path); + fd = open(buf, 0); if (fd < 0) return power->error = errno; @@ -54,12 +56,13 @@ int power_init(struct power *power) return 0; } -static uint64_t file_to_u64(const char *path) +static uint64_t file_to_u64(const char *name) { char buf[4096]; int fd, len; - fd = open(path, 0); + sprintf(buf, "%s/i915_energy_uJ", name); + fd = open(buf, 0); if (fd < 0) return 0; @@ -93,7 +96,7 @@ int power_update(struct power *power) if (power->error) return power->error; - s->energy = file_to_u64("/sys/kernel/debug/dri/0/i915_energy_uJ"); + s->energy = file_to_u64("i915_energy_uJ"); s->timestamp = clock_ms_to_u64(); if (power->count == 1) return EAGAIN; |