From patchwork Wed Sep 5 13:49:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10588891 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 5B1B85A4 for ; Wed, 5 Sep 2018 13:50:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 404212A223 for ; Wed, 5 Sep 2018 13:50:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E7932A227; Wed, 5 Sep 2018 13:50:07 +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 E91CA2A217 for ; Wed, 5 Sep 2018 13:50:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B1BCB6E4BB; Wed, 5 Sep 2018 13:50:04 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 43AB36E4B4 for ; Wed, 5 Sep 2018 13:49:57 +0000 (UTC) Received: by mail-wm0-x242.google.com with SMTP id 207-v6so7765574wme.5 for ; Wed, 05 Sep 2018 06:49:57 -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=nxMD7EMvd2UMJe7lVb30WFAgQmySrljr24IVJIwOCwY=; b=J8aUa5BBY3b+YRByLMxGzTymLTzRRxCqiNTzZyKf75ud2EnX5myHlAkjAARMp6LeOG g7ewslJs2uOZxUQT3Tbw2QN/VTpf1xpdpLtk6mXESZMpxPyZXvcg9QbDkvFXVfuAr8we bv8K6hpPGh4PmK/QAF24uNTAunV0WXFeECxRDnmQGpnZcgufi6GAA8Iq5a0cGQ9aF3e7 KfNQTHguwxAnj93/ultQjQ/ZhrwLz+Z8SI5WMSWZD7cGyNO6/3TAZ2Ut8UguQOl7Az8+ Ss/xquxrVguX1S/2FY+92JrgMPWRSf+8mMjJtKgZ3CsxfPkjBEUdr8fu7XheuS0khMZm tIkg== X-Gm-Message-State: APzg51AcdZumi5TuirUvPlyraRjsqVeVnkVLRk4LkiFNQDrLTwjKZ8rE KRzfc8af/Uf8PICT86Th3dNIRiPK5ns= X-Google-Smtp-Source: ANB0VdbpxtiDg4sz7ydswZ+X79/3tz1sKrcnM6z4ChqRpldYNShPd4kojEZhsZ9qejLMruQsnUNAEA== X-Received: by 2002:a1c:68f:: with SMTP id 137-v6mr325304wmg.82.1536155395904; 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.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Sep 2018 06:49:55 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org Date: Wed, 5 Sep 2018 14:49:38 +0100 Message-Id: <20180905134939.2942-13-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 12/13] media-bench: Write out trace files directly. 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 Instead of relying on shell redirection. Signed-off-by: Tvrtko Ursulin --- 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 () { + 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; }