From nobody Tue Feb 10 14:32:55 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1491908026137498.0441088116255; Tue, 11 Apr 2017 03:53:46 -0700 (PDT) Received: from localhost ([::1]:38446 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cxtQe-0005nb-QX for importer@patchew.org; Tue, 11 Apr 2017 06:53:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43747) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cxtNT-0003YB-E3 for qemu-devel@nongnu.org; Tue, 11 Apr 2017 06:50:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cxtNS-0004Sk-KP for qemu-devel@nongnu.org; Tue, 11 Apr 2017 06:50:27 -0400 Received: from mail-wm0-x22c.google.com ([2a00:1450:400c:c09::22c]:35891) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cxtNS-0004SW-Ds for qemu-devel@nongnu.org; Tue, 11 Apr 2017 06:50:26 -0400 Received: by mail-wm0-x22c.google.com with SMTP id o81so59948602wmb.1 for ; Tue, 11 Apr 2017 03:50:26 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id n13sm1962553wmi.28.2017.04.11.03.50.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Apr 2017 03:50:23 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 4B74C3E11B6; Tue, 11 Apr 2017 11:50:31 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pw8r5OsCd6u2WxAvehHIQNEptMzKWzqRr+XWQrl54h4=; b=T2udFhhMpB7/0gsN3Ixf9/LhWwi978rzb7hJbMhp3/VtkIP45fkpqZ+l12KsjpH/C8 9tL5Xk0GLpksnSZPslmIbkZaiOSidkSrCnSSUu8ldbK8Z6UpWBjuCPPVkzSY2GNqhAgn j0p7ntKpQeuBM3SjdULb8+iVomvG6OucX6Chc= 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:mime-version:content-transfer-encoding; bh=pw8r5OsCd6u2WxAvehHIQNEptMzKWzqRr+XWQrl54h4=; b=eYXNs3+VyBCcWUiFh+bzW5ygig6OQkbWZ+lWKATEq6WTQTF4h/nE4ESD+PdzbkoFuh HsnA0NNTv/2RfB4ofNxRpB1oiGgZg+9c7dEDrfWd9rV54hPxvNc8PVRxUGJhmnjeyxLJ 3nb7vlXJCdCxOcSRm9OT8pcfuY6ybzIdfdkhZ4UoSaIP08uKrCw415msQQbBpRd9/Cjr F/TYCmxihZQ18TQjU1pprrcDysBxYIwNqXkSnhP7/DbzJKfv64vniS3Y/idn/rPeWMmX ZoB9gN/UOZ3S9VKslphz2XyQ5XMo4SLisXyFOfXrxZa/gWdT6RV+ZP/FxK97Eu6oTNug aEZg== X-Gm-Message-State: AN3rC/5Jh8Xgdr2Q/55vcHJwi5B+vt+KI1c6BP+53NHvHSArnathQNHJQVXp4bbhnNMRmtci X-Received: by 10.28.215.147 with SMTP id o141mr12746636wmg.50.1491907825203; Tue, 11 Apr 2017 03:50:25 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: bobby.prani@gmail.com, rth@twiddle.net, stefanha@redhat.com Date: Tue, 11 Apr 2017 11:50:31 +0100 Message-Id: <20170411105031.28904-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170411105031.28904-1-alex.bennee@linaro.org> References: <20170411105031.28904-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::22c Subject: [Qemu-devel] [PATCH v1 3/3] new script/analyse-tlb-flushes-simpletrace.py X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 This is a simple helper script to extract TLB flush stats from the a simpletrace file and plot the results. Signed-off-by: Alex Benn=C3=A9e --- scripts/analyse-tlb-flushes-simpletrace.py | 62 ++++++++++++++++++++++++++= ++++ 1 file changed, 62 insertions(+) create mode 100755 scripts/analyse-tlb-flushes-simpletrace.py diff --git a/scripts/analyse-tlb-flushes-simpletrace.py b/scripts/analyse-t= lb-flushes-simpletrace.py new file mode 100755 index 0000000000..9a1191c154 --- /dev/null +++ b/scripts/analyse-tlb-flushes-simpletrace.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Generate a simple graph of flushes over time +# +# Author: Alex Benn=C3=A9e +# + +import os +import simpletrace +import argparse +import numpy as np +import matplotlib.pyplot as plt + +class CpuTLBFlushAnalyser(simpletrace.Analyzer): + "A simpletrace Analyser for extracting flush stats." + + def __init__(self): + self.stats =3D 0 + self.timestamps =3D [] + self.flush_self =3D [] + self.flush_async =3D [] + self.flush_synced =3D [] + + + def tlb_flush_stats(self, timestamp, flush_self, flush_async, flush_sy= nced): + "Match for tlb_flush_stats event. Appends counts to the relevant a= rray." + self.timestamps.append(timestamp) + self.flush_self.append(flush_self) + self.flush_async.append(flush_async) + self.flush_synced.append(flush_synced) + self.stats +=3D 1 + + +def get_args(): + "Grab options" + parser =3D argparse.ArgumentParser() + parser.add_argument("--output", "-o", type=3Dstr, help=3D"Render plot = to file") + parser.add_argument("events", type=3Dstr, help=3D'trace file read from= ') + parser.add_argument("tracefile", type=3Dstr, help=3D'trace file read f= rom') + return parser.parse_args() + +if __name__ =3D=3D '__main__': + args =3D get_args() + + # Gather data from the trace + analyzer =3D CpuTLBFlushAnalyser() + simpletrace.process(args.events, args.tracefile, analyzer) + +# x =3D np.arange(analyzer.stats) + fself, =3D plt.plot(analyzer.timestamps, analyzer.flush_self, label=3D= "Self") + fasync, =3D plt.plot(analyzer.timestamps, analyzer.flush_async, label= =3D"Async") + fsynced, =3D plt.plot(analyzer.timestamps, analyzer.flush_synced, labe= l=3D"Synced") + + plt.legend(handles=3D[fself, fasync, fsynced]) + plt.xlabel("Execution Time") + plt.ylabel("Culmlative count") + + if args.output: + plt.savefig(args.output) + else: + plt.show() --=20 2.11.0