From nobody Tue Feb 10 03:45:15 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1608050164; cv=none; d=zohomail.com; s=zohoarc; b=YY/sqoqRiYs+L67it1hSifNunXzgsQibhdw7gxi25OgscbalwpSCEl5rn6twMRqVzIih4ACIYWLAo3H3CJiYywsQKO1HGp0/yvMjEs5PgkZIyILs7Y03v85ZQYXLERFK2tRCwR397M0wA/3LIaUnodKrmeVkgSKXB3DmXaWlQv8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608050164; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vOJRvAbon90dj3ynAoLFDYQ7z1K4uODUAHbPD/JD1Iw=; b=gFUXs8P8taykX1Gx85mJ4Nk+9wJxlrMetsGzEgNJK+pYVN6xSOJZFgapdoCWnHn68fp+daoIn/h1+kbwqWgWdqna9Olp6jOHNIDyh8Brq3EAywu72WsW2DvH9AkerJfRQsmJk/P3O8blPrmYPIFgywykPvaI/HrvXv6E5RR9ocg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1608050164912266.6661060951028; Tue, 15 Dec 2020 08:36:04 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-375-3W83hcptN3yiVp-kLKEvFQ-1; Tue, 15 Dec 2020 11:25:57 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 87701BBEE3; Tue, 15 Dec 2020 16:25:41 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 617315D9D7; Tue, 15 Dec 2020 16:25:41 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 286271809C9F; Tue, 15 Dec 2020 16:25:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0BFGPYDR025748 for ; Tue, 15 Dec 2020 11:25:34 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3765C5D968; Tue, 15 Dec 2020 16:25:34 +0000 (UTC) Received: from work.redhat.com (ovpn-114-20.ams2.redhat.com [10.36.114.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 661565D9D7; Tue, 15 Dec 2020 16:25:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608049560; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=vOJRvAbon90dj3ynAoLFDYQ7z1K4uODUAHbPD/JD1Iw=; b=D9aNBGGQfYMgCzJG/We46HUbl95FkekW71/A6jzhIQc9HMJ2iuHIbNM7Fo73iH0W22Ea64 5mECpY4YJ9QF2g+dVkXUVrcae+Myv0eXpMxNGRJbxVQhFfdiaW6Ov23w2MVhfg6IL7dV77 XUwDk/jQSKclpuINFILK3hr9I+WxuWs= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608050162; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=vOJRvAbon90dj3ynAoLFDYQ7z1K4uODUAHbPD/JD1Iw=; b=Lmz6MSvw0Q00wSeC0pdl6KGBRIghGbSEJIYFS/SQUDuv2+tJi0t19r7MijUvRt/4hiSZ1W JK9LO7cqaNOdNHqlmjrz7RgdwaC5r918idTitrpVyU1yRlPBnjkuXOBSxb6RwIYW/K+UgP SWwVnZoV9qvo1xwykzxLABQNi/QX4WA= X-MC-Unique: 3W83hcptN3yiVp-kLKEvFQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 15/29] cpu-gather: Separate data input and output Date: Tue, 15 Dec 2020 17:25:01 +0100 Message-Id: <20201215162515.53742-16-twiederh@redhat.com> In-Reply-To: <20201215162515.53742-1-twiederh@redhat.com> References: <20201215162515.53742-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This is a preparatory step to replace the output format with something more readable. Signed-off-by: Tim Wiederhake --- tests/cputestdata/cpu-gather.py | 50 +++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather= .py index 9c609aa6e9..005d1019b6 100755 --- a/tests/cputestdata/cpu-gather.py +++ b/tests/cputestdata/cpu-gather.py @@ -183,6 +183,36 @@ def gather_model(args): ]) =20 =20 +def gather(args): + result =3D dict() + result["name"] =3D gather_name(args) + result["leaves"] =3D list(gather_cpuid_leaves(args)) + result["via"], result["msr"] =3D gather_msr() + result["model"] =3D list(gather_model(args)) + return result + + +def output_to_text(data): + output =3D list() + + output.append("model name\t: {}".format(data["name"])) + + output.append("CPU:") + for leave in data["leaves"]: + output.append(" {}".format(leave)) + output.append("") + + if data["via"] is not None: + output.append("MSR{}:".format(data["via"])) + for key, value in sorted(data["msr"].items()): + output.append(" 0x{:x}: 0x{:016x}\n".format(int(key), value)) + + for o in data["model"]: + output.append(json.dumps(o)) + + return "\n".join(output) + + def main(): parser =3D argparse.ArgumentParser(description=3D"Gather cpu test data= ") parser.add_argument( @@ -213,24 +243,8 @@ def main(): if os.path.isfile(f): args.path_to_qemu =3D f =20 - name =3D gather_name(args) - print("model name\t: {}".format(name)) - - leaves =3D gather_cpuid_leaves(args) - print("CPU:") - for leave in leaves: - print(" {}".format(leave)) - print() - - via, msr =3D gather_msr() - if via is not None: - print("MSR{}:".format(via)) - for key, value in sorted(msr.items()): - print(" 0x{:x}: 0x{:016x}\n".format(int(key), value)) - - model =3D gather_model(args) - for o in model: - print(json.dumps(o)) + data =3D gather(args) + print(output_to_text(data)) =20 =20 if __name__ =3D=3D "__main__": --=20 2.26.2