[Intel-gfx] [PATCH i-g-t] scripts/trace.pl: Rudimentary preemption support
Tvrtko Ursulin
tursulin at ursulin.net
Wed Dec 20 10:21:21 UTC 2017
From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
Make the script survive preemption by simply forgetting the previous
request_in event happened.
Downside of the trivial approach is that the timeline will not show
the preemption event, but it will be as if the request only got
submitted to the hardware for the first time when it was submitted
the final time, the time it actually ran to completion.
Runnable time accounting will also be over-accounted.
To solve this properly heavier refactoring is needed, and some design
thought, but for the moment this at least makes the script not die.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
Cc: John Harrison <John.C.Harrison at intel.com>
---
scripts/trace.pl | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/scripts/trace.pl b/scripts/trace.pl
index 2628a41abfc4..879e02365f34 100755
--- a/scripts/trace.pl
+++ b/scripts/trace.pl
@@ -423,7 +423,9 @@ while (<>) {
} elsif ($tp_name eq 'i915:i915_gem_request_in:') {
my %req;
- die if exists $db{$key};
+ # Duplicated req in is a sign of preemption - just forget it
+ # happened before.
+ delete $db{$key} if exists $db{$key};
die unless exists $queue{$key};
die unless exists $submit{$key};
@@ -443,7 +445,8 @@ while (<>) {
} elsif ($tp_name eq 'i915:i915_gem_request_out:') {
my $gkey = global_key($ring, $tp{'global'});
- die unless exists $db{$key};
+# # Probable incomplete trace, not gathered with trace.pl --trace.
+ next unless exists $db{$key};
die unless exists $db{$key}->{'start'};
die if exists $db{$key}->{'end'};
--
2.14.1
More information about the Intel-gfx
mailing list