From patchwork Wed Sep 5 13:49:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10588889 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6DA3715E9 for ; Wed, 5 Sep 2018 13:50:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D6802A209 for ; Wed, 5 Sep 2018 13:50:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 51CE72A1F3; Wed, 5 Sep 2018 13:50:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E27CC2A1DA for ; Wed, 5 Sep 2018 13:50:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C1CF16E4B6; Wed, 5 Sep 2018 13:49:59 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7FC756E49C for ; Wed, 5 Sep 2018 13:49:56 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id a108-v6so7700706wrc.13 for ; Wed, 05 Sep 2018 06:49:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vQMgCkXhwMvBOHm/cDIIsMZGXoNL9B/LNMC8epTjA0Q=; b=pJCJPfsu09dhcSZRmj8/K432JqP5kpTNcFhVb0uVBiqjl+nhTQKS1Y98Z4qhcBBTJW q10HFLINSkblNSahmX26ycovSV2WqFBvSzLUkfc/0/SWj71JRRLithE1A3dhy4ACpC2v IF+qHSBHAkDWRS7AhFmujMXdwwgmE3JzVSnwZrAoB5AFU5VBuqlPf3Oame1SrJUVcweF KC9Yz7q5nSqno9bJxN5KAPNXB+QAdi4+F4w0Us236+LHwR+QtFzz0EjDeu9mkgk971UP 1r1fZ2aB+y8plrlIBkHtD8NBoI9ihffLeZCTW5a7fl0NLKGTVWr+nEUuhdB7sawx4x73 +fIw== X-Gm-Message-State: APzg51Dx+Hf7wW3AijC36+rdsZWcAAN74ZylyGT5czu6nkiFCAuyX7OD COJoa2j+D3bCJZoIbIeYjy5+5w== X-Google-Smtp-Source: ANB0VdayQUxDqfzPQsaGeKI8ZG+0fmjimB9ZJkaR9pZWuGkb+J1WSRWzWlkfgSa2hOnNJk0VuCkymg== X-Received: by 2002:a5d:4b52:: with SMTP id w18-v6mr26023485wrs.87.1536155395132; Wed, 05 Sep 2018 06:49:55 -0700 (PDT) Received: from localhost.localdomain ([95.144.165.37]) by smtp.gmail.com with ESMTPSA id j66-v6sm2701639wrj.28.2018.09.05.06.49.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Sep 2018 06:49:54 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org Date: Wed, 5 Sep 2018 14:49:37 +0100 Message-Id: <20180905134939.2942-12-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180905134939.2942-1-tvrtko.ursulin@linux.intel.com> References: <20180905134939.2942-1-tvrtko.ursulin@linux.intel.com> Subject: [Intel-gfx] [PATH i-g-t 11/13] media-bench: Fix tracing of direct workloads X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Intel-gfx@lists.freedesktop.org MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Tvrtko Ursulin Build argument list properly and check exit codes when executing sub-commands. Signed-off-by: Tvrtko Ursulin --- scripts/media-bench.pl | 54 +++++++++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 19 deletions(-) diff --git a/scripts/media-bench.pl b/scripts/media-bench.pl index 5070cae088f3..9bf8c8789fe2 100755 --- a/scripts/media-bench.pl +++ b/scripts/media-bench.pl @@ -131,7 +131,8 @@ sub add_wps_arg return @args if $realtime_target <= 0; $period = int(1000000 / $realtime_target); - push @args, "-a p.$period"; + push @args, '-a'; + push @args, 'p.$period'; return @args; } @@ -144,7 +145,7 @@ sub run_workload @args = add_wps_arg(@args); push @args, '-2' if $gt2; - unshift @args, "$wsim"; + unshift @args, $wsim; $cmd = join ' ', @args; show_cmd($cmd); @@ -164,23 +165,31 @@ sub run_workload sub trace_workload { my ($wrk, $b, $r, $c) = @_; - my @args = ( "-n $nop", "-r $r", "-c $c"); + my @args = ($tracepl, '--trace', $wsim, '-q', '-n', $nop, '-r', $r, '-c', $c); my $min_batches = 16 + $r * $c / 2; my @skip_engine; my %engines; my ($cmd, $file); - my $warg = defined $w_direct ? $wrk : "-w $wrk_root/$wrk"; - push @args, "$b -R" unless $b eq ''; push @args, '-2' if $gt2; - push @args, $warg; - unshift @args, '-q'; - unshift @args, "$tracepl --trace $wsim"; + unless ($b eq '') { + push @args, '-R'; + push @args, split /\s+/, $b; + } - $cmd = join ' ', @args; - show_cmd($cmd); - system($cmd); + if (defined $w_direct) { + push @args, split /\s+/, $wrk; + } else { + push @args, '-w'; + push @args, $wrk_root . '/' . $wrk; + } + + show_cmd(join ' ', @args); + if (-e 'perf.data') { + unlink 'perf.data' or die; + } + system(@args) == 0 or die; $cmd = "perf script | $tracepl"; show_cmd($cmd); @@ -205,13 +214,13 @@ sub trace_workload $cmd = "perf script > ${file}.trace"; show_cmd($cmd); - system($cmd); + system($cmd) == 0 or die; $cmd = "perf script | $tracepl --html -x ctxsave -s -c "; $cmd .= join ' ', map("-i $_", @skip_engine); $cmd .= " > ${file}.html"; show_cmd($cmd); - system($cmd); + system($cmd) == 0 or die; return \%engines; } @@ -219,7 +228,6 @@ sub trace_workload sub calibrate_workload { my ($wrk) = @_; - my $warg = defined $w_direct ? $wrk : "-w $wrk_root/$wrk"; my $tol = $tolerance; my $loops = 0; my $error; @@ -227,9 +235,16 @@ sub calibrate_workload $r = $realtime_target > 0 ? $realtime_target * $client_target_s : 23; for (;;) { - my @args = ( "-n $nop", "-r $r", $warg); + my @args = ('-n', $nop, '-r', $r); my ($time, $wps); + if (defined $w_direct) { + push @args, split /\s+/, $wrk; + } else { + push @args, '-w'; + push @args, $wrk_root . '/' . $wrk; + } + ($time, $wps) = run_workload(@args); $error = abs($time - $client_target_s) / $client_target_s; @@ -254,23 +269,24 @@ sub find_saturation_point my ($last_wps, $c, $swps); my $target = $realtime_target > 0 ? $realtime_target : $wps_target; my $r = $rr; - my ($warg, $wcnt); + my $wcnt; my $maxc; my $max = 0; if (defined $w_direct) { - $warg = $wrk; + push @args, split /\s+/, $wrk; $wcnt = () = $wrk =~ /-[wW]/gi; } else { - $warg = "-w $wrk_root/$wrk"; + push @args, '-w'; + push @args, $wrk_root . '/' . $wrk; $wcnt = 1; } for ($c = 1; ; $c = $c + 1) { my ($time, $wps); - ($time, $wps) = run_workload((@args, ($warg, "-r $r", "-c $c"))); + ($time, $wps) = run_workload((@args, ('-r', $r, '-c', $c))); say " $c clients is $wps wps." if $verbose;