[igt-dev] [PATH i-g-t 12/13] media-bench: Write out trace files directly.
Tvrtko Ursulin
tursulin at ursulin.net
Wed Sep 5 13:49:38 UTC 2018
From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
Instead of relying on shell redirection.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
scripts/media-bench.pl | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/scripts/media-bench.pl b/scripts/media-bench.pl
index 9bf8c8789fe2..77e75c78b113 100755
--- a/scripts/media-bench.pl
+++ b/scripts/media-bench.pl
@@ -162,6 +162,21 @@ sub run_workload
return ($time, $wps);
}
+sub dump_cmd
+{
+ my ($cmd, $file) = @_;
+
+ show_cmd("$cmd > $file");
+
+ open FOUT, '>', $file or die;
+ open TIN, "$cmd |" or die;
+ while (<TIN>) {
+ print FOUT $_;
+ }
+ close TIN;
+ close FOUT;
+}
+
sub trace_workload
{
my ($wrk, $b, $r, $c) = @_;
@@ -212,15 +227,12 @@ sub trace_workload
$b =~ s/[ <>]/_/g;
$file = "${wrk}_${b}_-r${r}_-c${c}";
- $cmd = "perf script > ${file}.trace";
- show_cmd($cmd);
- system($cmd) == 0 or die;
+ dump_cmd('perf script', "${file}.trace");
$cmd = "perf script | $tracepl --html -x ctxsave -s -c ";
$cmd .= join ' ', map("-i $_", @skip_engine);
- $cmd .= " > ${file}.html";
- show_cmd($cmd);
- system($cmd) == 0 or die;
+
+ dump_cmd($cmd, "${file}.html");
return \%engines;
}
--
2.17.1
More information about the igt-dev
mailing list