diff options
author | Tvrtko Ursulin <tvrtko.ursulin@intel.com> | 2017-09-13 18:08:02 +0100 |
---|---|---|
committer | Tvrtko Ursulin <tvrtko.ursulin@intel.com> | 2017-11-22 11:18:14 +0000 |
commit | 47fef4731e0f0f77b35a09e091b11c56669feb1b (patch) | |
tree | 594f5ec62f7d65ac603073ee777c58c1260466ba /overlay/gpu-freq.c | |
parent | a688deceae195aec863d8de45bdaefb251927c89 (diff) |
intel-gpu-overlay: Consolidate perf PMU access to library
Various tool modules implement their owm PMU open wrapper which
can be replaced by calling the library one.
v2:
* Remove extra newline. (Chris Wilson)
* Commit msg.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'overlay/gpu-freq.c')
-rw-r--r-- | overlay/gpu-freq.c | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/overlay/gpu-freq.c b/overlay/gpu-freq.c index 7f29b1aa..76c5ed9a 100644 --- a/overlay/gpu-freq.c +++ b/overlay/gpu-freq.c @@ -33,30 +33,12 @@ #include "gpu-freq.h" #include "debugfs.h" -static int perf_i915_open(int config, int group) -{ - struct perf_event_attr attr; - - memset(&attr, 0, sizeof (attr)); - - attr.type = i915_type_id(); - if (attr.type == 0) - return -ENOENT; - attr.config = config; - - attr.read_format = PERF_FORMAT_TOTAL_TIME_ENABLED; - if (group == -1) - attr.read_format |= PERF_FORMAT_GROUP; - - return perf_event_open(&attr, -1, 0, group, 0); -} - static int perf_open(void) { int fd; - fd = perf_i915_open(I915_PERF_ACTUAL_FREQUENCY, -1); - if (perf_i915_open(I915_PERF_REQUESTED_FREQUENCY, fd) < 0) { + fd = perf_i915_open_group(I915_PERF_ACTUAL_FREQUENCY, -1); + if (perf_i915_open_group(I915_PERF_REQUESTED_FREQUENCY, fd) < 0) { close(fd); fd = -1; } |