diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2019-10-13 13:53:43 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2019-10-15 14:54:09 +0100 |
commit | e293051f8f99c72cb01d21e4b73a5928ea351eb3 (patch) | |
tree | f8d65c3f5c83a890bdc33e23428702b82edb7f04 /tests/i915/gem_exec_whisper.c | |
parent | 1a644320e76f6d7cb13462804b5a8897c9b7d057 (diff) |
lib: Generalise rapl interface
We can use our existing rapl interface that monitors gpu power, to also
sample the other rapl domains such as package, cores and ram.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Andi Shyti <andi.shyti@intel.com>
Reviewed-by: Andi Shyti <andi.shyti@intel.com>
Diffstat (limited to 'tests/i915/gem_exec_whisper.c')
-rw-r--r-- | tests/i915/gem_exec_whisper.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/tests/i915/gem_exec_whisper.c b/tests/i915/gem_exec_whisper.c index de7a14da..1135c649 100644 --- a/tests/i915/gem_exec_whisper.c +++ b/tests/i915/gem_exec_whisper.c @@ -29,7 +29,7 @@ #include "igt.h" #include "igt_debugfs.h" -#include "igt_gpu_power.h" +#include "igt_rapl.h" #include "igt_gt.h" #include "igt_rand.h" #include "igt_sysfs.h" @@ -186,8 +186,8 @@ static void whisper(int fd, unsigned engine, unsigned flags) unsigned int reloc_migrations = 0; unsigned int reloc_interruptions = 0; unsigned int eb_migrations = 0; - struct gpu_power_sample sample[2]; - struct gpu_power power; + struct power_sample sample[2]; + struct rapl rapl; uint64_t old_offset; int i, n, loc; int debugfs; @@ -199,7 +199,7 @@ static void whisper(int fd, unsigned engine, unsigned flags) } debugfs = igt_debugfs_dir(fd); - gpu_power_open(&power); + gpu_power_open(&rapl); nengine = 0; if (engine == ALL_ENGINES) { @@ -234,7 +234,7 @@ static void whisper(int fd, unsigned engine, unsigned flags) nchild *= nengine; intel_detect_and_clear_missed_interrupts(fd); - gpu_power_read(&power, &sample[0]); + rapl_read(&rapl, &sample[0]); igt_fork(child, nchild) { unsigned int pass; @@ -510,11 +510,12 @@ static void whisper(int fd, unsigned engine, unsigned flags) fini_hang(&hang); else igt_assert_eq(intel_detect_and_clear_missed_interrupts(fd), 0); - if (gpu_power_read(&power, &sample[1])) { + if (rapl_read(&rapl, &sample[1])) { igt_info("Total energy used: %.1fmJ\n", - gpu_power_J(&power, &sample[0], &sample[1]) * 1e3); + power_J(&rapl, &sample[0], &sample[1]) * 1e3); } + rapl_close(&rapl); close(debugfs); } |