public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tursulin@ursulin.net>
To: Intel-gfx@lists.freedesktop.org
Subject: [RFC i-g-t 2/2] tools/intel_engine_stats: Just a demo
Date: Wed,  2 Aug 2017 13:33:12 +0100	[thread overview]
Message-ID: <20170802123312.14292-3-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <20170802123312.14292-1-tvrtko.ursulin@linux.intel.com>

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

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@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

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2017-08-02 12:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-02 12:33 [RFC i-g-t 0/2] IGT PMU support Tvrtko Ursulin
2017-08-02 12:33 ` [RFC i-g-t 1/2] intel-gpu-overlay: Use new class/instance based PMU API Tvrtko Ursulin
2017-08-02 12:56   ` Chris Wilson
2017-08-02 12:58   ` Petri Latvala
2017-08-02 12:33 ` Tvrtko Ursulin [this message]
2017-08-02 13:01   ` [RFC i-g-t 2/2] tools/intel_engine_stats: Just a demo Petri Latvala
2017-08-02 13:02   ` Chris Wilson
2017-08-02 13:10     ` Tvrtko Ursulin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170802123312.14292-3-tvrtko.ursulin@linux.intel.com \
    --to=tursulin@ursulin.net \
    --cc=Intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox