summaryrefslogtreecommitdiff
path: root/tests/i915
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2019-02-01 09:04:17 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2019-03-26 10:13:11 +0000
commitc56b2d75122b1ea29731915c2fe22242480da563 (patch)
tree4705efc032380b51fea08e69fa1818ad4e452f0c /tests/i915
parent8c69d24ebef37482d67a8e99d29006ad4feb2e33 (diff)
i915/gem_exec_whisper: Measure total power consumed
Show the total power consumed across all the whispers. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Diffstat (limited to 'tests/i915')
-rw-r--r--tests/i915/gem_exec_whisper.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/i915/gem_exec_whisper.c b/tests/i915/gem_exec_whisper.c
index 0b15fe43..6c3b5375 100644
--- a/tests/i915/gem_exec_whisper.c
+++ b/tests/i915/gem_exec_whisper.c
@@ -28,8 +28,9 @@
*/
#include "igt.h"
-#include "igt_gt.h"
#include "igt_debugfs.h"
+#include "igt_gpu_power.h"
+#include "igt_gt.h"
#include "igt_rand.h"
#include "igt_sysfs.h"
@@ -192,6 +193,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;
uint64_t old_offset;
int i, n, loc;
int debugfs;
@@ -202,6 +205,7 @@ static void whisper(int fd, unsigned engine, unsigned flags)
}
debugfs = igt_debugfs_dir(fd);
+ gpu_power_open(&power);
nengine = 0;
if (engine == ALL_ENGINES) {
@@ -226,6 +230,7 @@ static void whisper(int fd, unsigned engine, unsigned flags)
init_hang(&hang);
intel_detect_and_clear_missed_interrupts(fd);
+ gpu_power_read(&power, &sample[0]);
igt_fork(child, flags & FORKED ? sysconf(_SC_NPROCESSORS_ONLN) : 1) {
unsigned int pass;
@@ -495,6 +500,10 @@ 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])) {
+ igt_info("Total energy used: %.1fmJ\n",
+ gpu_power_J(&power, &sample[0], &sample[1]) * 1e3);
+ }
close(debugfs);
}