[Intel-gfx] [RFC i-g-t 2/2] tools/intel_engine_stats: Just a demo

Tvrtko Ursulin tursulin at ursulin.net
Wed Aug 2 12:33:12 UTC 2017


From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
 tools/Makefile.sources     |  1 +
 tools/intel_engine_stats.c | 40 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+)
 create mode 100644 tools/intel_engine_stats.c

diff --git a/tools/Makefile.sources b/tools/Makefile.sources
index 6d9a6aceb354..7b88d4675588 100644
--- a/tools/Makefile.sources
+++ b/tools/Makefile.sources
@@ -12,6 +12,7 @@ tools_prog_lists =		\
 	intel_bios_dumper	\
 	intel_display_crc	\
 	intel_display_poller	\
+	intel_engine_stats	\
 	intel_forcewaked	\
 	intel_gpu_frequency	\
 	intel_firmware_decode	\
diff --git a/tools/intel_engine_stats.c b/tools/intel_engine_stats.c
new file mode 100644
index 000000000000..24dbb1eb6a57
--- /dev/null
+++ b/tools/intel_engine_stats.c
@@ -0,0 +1,40 @@
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include "drmtest.h"
+#include "igt_debugfs.h"
+
+int main(void)
+{
+	int drm_fd, fd;
+
+	drm_fd = drm_open_driver(DRIVER_INTEL);
+
+	fd = igt_debugfs_open(drm_fd, "i915_engine_stats", O_RDONLY);
+	igt_assert(fd >= 0);
+
+	for (;;) {
+		char buf[4096];
+		ssize_t ret;
+		off_t off;
+
+		ret = read(fd, buf, sizeof(buf));
+		igt_assert(ret > 0);
+
+		ret = write(1, buf, ret);
+		printf("\n");
+
+		off = lseek(fd, 0, SEEK_SET);
+		igt_assert_eq(off, 0);
+
+		sleep(1);
+	}
+
+	close(fd);
+	close(drm_fd);
+
+	return 0;
+}
-- 
2.9.4



More information about the Intel-gfx mailing list