All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC 0/3] Engine utilization tracking
@ 2017-05-09 14:09 Tvrtko Ursulin
  2017-05-09 14:09 ` [RFC 1/3] drm/i915: Wrap context schedule notification Tvrtko Ursulin
                   ` (4 more replies)
  0 siblings, 5 replies; 19+ messages in thread
From: Tvrtko Ursulin @ 2017-05-09 14:09 UTC (permalink / raw)
  To: Intel-gfx

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

By popular customer demand here is the prototype for cheap engine utilization
tracking.

It uses static branches so in the default off case it really should be cheap.

It exports the per engine total time something has been executing (in nano-
seconds) in debugfs/i915_engine_stats.

This is a problem for something which would preferrably be a stable ABI but I
needed all of the open, release and read hooks for it to work as I imagined it.
So far I did not come up with a different location which would support that.

Userspace is supposed to open the file and keep re-reading it by seeking to its
beginning. This is because first open and last close are a costly operations,
and also because the most interesting is the relative change between two
sampling periods.

Example code which does this looks like this:

	#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;
	}

Comments, flames, ideas welcome!

Tvrtko Ursulin (3):
  drm/i915: Wrap context schedule notification
  drm/i915: Engine busy time tracking
  drm/i915: Export engine busy stats in debugfs

 drivers/gpu/drm/i915/i915_debugfs.c     | 120 ++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_engine_cs.c  |   6 ++
 drivers/gpu/drm/i915/intel_lrc.c        |  24 +++++--
 drivers/gpu/drm/i915/intel_ringbuffer.h |  39 +++++++++++
 4 files changed, 182 insertions(+), 7 deletions(-)

-- 
2.9.3

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

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2017-05-12 17:40 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-09 14:09 [RFC 0/3] Engine utilization tracking Tvrtko Ursulin
2017-05-09 14:09 ` [RFC 1/3] drm/i915: Wrap context schedule notification Tvrtko Ursulin
2017-05-09 14:09 ` [RFC 2/3] drm/i915: Engine busy time tracking Tvrtko Ursulin
2017-05-10 12:41   ` Joonas Lahtinen
2017-05-09 14:09 ` [RFC 3/3] drm/i915: Export engine busy stats in debugfs Tvrtko Ursulin
2017-05-09 18:17   ` Dmitry Rogozhkin
2017-05-10  8:30     ` Tvrtko Ursulin
2017-05-10 15:57       ` Dmitry Rogozhkin
2017-05-09 14:26 ` [RFC 0/3] Engine utilization tracking Chris Wilson
2017-05-09 15:16   ` Tvrtko Ursulin
2017-05-09 15:29     ` Chris Wilson
2017-05-09 15:51       ` Tvrtko Ursulin
2017-05-09 18:11         ` Dmitry Rogozhkin
2017-05-10  8:38           ` Tvrtko Ursulin
2017-05-10 15:50             ` Dmitry Rogozhkin
2017-05-10 19:45             ` Daniel Vetter
2017-05-12 17:40               ` Dmitry Rogozhkin
2017-05-10 12:31         ` Chris Wilson
2017-05-09 14:51 ` ✓ Fi.CI.BAT: success for " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.