From 1c3fd70357a57f823846010f59ba75f19e5d4af9 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 27 Aug 2013 11:20:43 +0100 Subject: overlay: Read power from perf_events Signed-off-by: Chris Wilson --- overlay/gpu-top.c | 47 ++++------------------------------------------- 1 file changed, 4 insertions(+), 43 deletions(-) (limited to 'overlay/gpu-top.c') diff --git a/overlay/gpu-top.c b/overlay/gpu-top.c index 751d5fcb..1efbbfd3 100644 --- a/overlay/gpu-top.c +++ b/overlay/gpu-top.c @@ -22,7 +22,6 @@ * */ -#include #include #include #include @@ -31,6 +30,7 @@ #include #include +#include "perf.h" #include "igfx.h" #include "gpu-top.h" @@ -46,45 +46,6 @@ #define I915_PERF_RING_WAIT(n) (__I915_PERF_RING(n) + 1) #define I915_PERF_RING_SEMA(n) (__I915_PERF_RING(n) + 2) -static int -perf_event_open(struct perf_event_attr *attr, - pid_t pid, - int cpu, - int group_fd, - unsigned long flags) -{ -#ifndef __NR_perf_event_open -#if defined(__i386__) -#define __NR_perf_event_open 336 -#elif defined(__x86_64__) -#define __NR_perf_event_open 298 -#else -#define __NR_perf_event_open 0 -#endif -#endif - attr->size = sizeof(*attr); - return syscall(__NR_perf_event_open, attr, pid, cpu, group_fd, flags); -} - -static uint64_t i915_type_id(void) -{ - char buf[1024]; - int fd, n; - - fd = open("/sys/bus/event_source/devices/i915/type", 0); - if (fd < 0) { - n = -1; - } else { - n = read(fd, buf, sizeof(buf)-1); - close(fd); - } - if (n < 0) - return 0; - - buf[n] = '\0'; - return strtoull(buf, 0, 0); -} - static int perf_i915_open(int config, int group) { struct perf_event_attr attr; @@ -106,9 +67,9 @@ static int perf_i915_open(int config, int group) static int perf_init(struct gpu_top *gt) { const char *names[] = { - "render", - "bitstream", - "bliter", + "RCS", + "VCS", + "BCS", NULL, }; int n; -- cgit v1.2.3