[Intel-gfx] [RFC] I915 Wait Accounting, attempt 2

Ben Gamari bgamari.foss at gmail.com
Wed Jun 24 22:57:54 CEST 2009


Hey all,

So last night I did some research concerning the wait accounting issue. While
ftrace ended up being a dead-end, I did find that systemtap does pretty much
exactly what we are looking for. As far as I can tell, the best way to handle
wait time accounting is to simply expose a kernel marker triggered on every
wait event. From here we can use a systemtap tapset triggered on the marker to
acquire a backtrace and count events. This is a patch that does just that. This
patch isn't even build-tested yet, but it should get the point across.

One possible tapset implementation would look something like the following. Not
sure if this works or not but if should be roughly along these lines. Let me
know what you all think.

Thanks,

- Ben



global times[N_WAIT_SOURCES]
global counts[N_WAIT_SOURCES]
global traces
global trace_idx[N_WAIT_SOURCES]

probe begin {
	foreach 
probe module("i915").mark("i915_wait") {
	src = $arg1;
	time = $arg2;

	counts[$src]++;
	times[$src] += $time;

	traces[$src,trace_idx[$src],'kernel'] = backtrace();
	traces[$src,trace_idx[$src],'user'] = ubacktrace();
	trace_idx[$src]++;
}

probe end {
	printf("SRC\tCOUNT\tTIME\n");
	foreach (t in traces) {
		printf("%d\t%d\n", t, counts[t], times[t]);
	}

	printf("Backtraces\n");
	foreach ([t,i] in traces) {
		printf("\nBacktrace for source %d:\n", t);
		printf("Kernel:\n");
		print_stack(traces[t,i,'kernel']);
		printf("User:\n");
		print_ustack(traces[t,i,'user']);
	}
}




More information about the Intel-gfx mailing list