Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1734819imm; Thu, 12 Jul 2018 07:03:06 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf8v6Vw9NvA2N3rUDRJlOhU8k/w4M0T4+lA+6U7eL4VhqeTAjLX5vlJ42uOIfD0OugsytmL X-Received: by 2002:a62:3f99:: with SMTP id z25-v6mr2604511pfj.250.1531404186165; Thu, 12 Jul 2018 07:03:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531404186; cv=none; d=google.com; s=arc-20160816; b=tQAa4v0PMFFBGq3irxvdKzF1jQB6OeFJ/b+K9UqVhXH9WLJ9N8fKM+G/42Q+HWySvz 5j8LNu0F6OXj5ZTaa7qJgTT9ZSXyHgo63f4WR8F3E4+LTKpbX0oYmH0La56YHaAoRA+6 DQXqt5TnGh3cYE3BReEvGD2u75z9Sm6tXMJn55qQjKtiut2UmlWIzqORfJ648IuH85GO KmVTGwKidH0Kpgst9X+e6neaQlr8kCMXe9HlYZVxJLrfpGopC4R0Uulb9o+EJXoQMRoP B41GomTb3xWOXht7XU08AwLt/dAxGQckXaR2zdoc3hXUjB63csN+OS3ytRxh/YOD677g FCAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=oSdgHH6B49AF6e08dpWarnkfIkfSwxmdDNEbLzxoZrY=; b=thPBGc1GQq0Ml+Q6av7Yki+E3llta2UAiIxURMImylVx2xJL2AQf5y51F+gA9Bh424 bprKlx0TzofE6M0ZkYlA1kKxmPYgPoEclTaYGH9d3HhrwaWe8ZlsTtL7xGs66/tVf8HQ 94D0i+BwqcSn+sorazqj6z00t3ChY3vzy/Di760T6Pucu4mWRilcABT9bHWO5RiPbugm vBZx2EBKrky5NvGPDn/bq3Z49zZURrH4mS/d9epBxyYbOa6c+r0XEoPPu/HXywbnrJg0 ZYgbTAGzAnnzhVv3vOS1fsYS5tKPJTrD1mI/qRdbRRAGatyRwBt+/aG8qgDgnIrUPbxK j6kg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x62-v6si19378662pfa.80.2018.07.12.07.02.48; Thu, 12 Jul 2018 07:03:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732588AbeGLOL0 (ORCPT + 99 others); Thu, 12 Jul 2018 10:11:26 -0400 Received: from terminus.zytor.com ([198.137.202.136]:56353 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727497AbeGLOL0 (ORCPT ); Thu, 12 Jul 2018 10:11:26 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w6CDxO6v3934351 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 12 Jul 2018 06:59:24 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w6CDxOSM3934348; Thu, 12 Jul 2018 06:59:24 -0700 Date: Thu, 12 Jul 2018 06:59:24 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Jeremy Cline Message-ID: Cc: peterz@infradead.org, mingo@kernel.org, jeremy@jcline.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, jolsa@redhat.com, herton@redhat.com, acme@redhat.com, alexander.shishkin@linux.intel.com, hpa@zytor.com, namhyung@kernel.org Reply-To: acme@redhat.com, herton@redhat.com, jolsa@redhat.com, linux-kernel@vger.kernel.org, tglx@linutronix.de, peterz@infradead.org, mingo@kernel.org, jeremy@jcline.org, namhyung@kernel.org, hpa@zytor.com, alexander.shishkin@linux.intel.com In-Reply-To: <0100016341a730c6-8db8b9b1-da2d-4ee3-96bf-47e0ae9796bd-000000@email.amazonses.com> References: <0100016341a730c6-8db8b9b1-da2d-4ee3-96bf-47e0ae9796bd-000000@email.amazonses.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf scripts python: Add Python 3 support to Util.py Git-Commit-ID: c45b168effb12719f6dfc8d2c20ba8c057e8c16b X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_96_Q autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: c45b168effb12719f6dfc8d2c20ba8c057e8c16b Gitweb: https://git.kernel.org/tip/c45b168effb12719f6dfc8d2c20ba8c057e8c16b Author: Jeremy Cline AuthorDate: Tue, 8 May 2018 21:27:46 +0000 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 11 Jul 2018 10:01:50 -0300 perf scripts python: Add Python 3 support to Util.py Support both Python 2 and Python 3 in Util.py. The dict class no longer has a ``has_key`` method and print is now a function rather than a statement. This should have no functional change. Signed-off-by: Jeremy Cline Cc: Alexander Shishkin Cc: Herton Krzesinski Cc: Jiri Olsa Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/0100016341a730c6-8db8b9b1-da2d-4ee3-96bf-47e0ae9796bd-000000@email.amazonses.com Signed-off-by: Arnaldo Carvalho de Melo --- .../scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py b/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py index f6c84966e4f8..7384dcb628c4 100644 --- a/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py +++ b/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py @@ -5,6 +5,7 @@ # This software may be distributed under the terms of the GNU General # Public License ("GPL") version 2 as published by the Free Software # Foundation. +from __future__ import print_function import errno, os @@ -33,7 +34,7 @@ def nsecs_str(nsecs): return str def add_stats(dict, key, value): - if not dict.has_key(key): + if key not in dict: dict[key] = (value, value, value, 1) else: min, max, avg, count = dict[key] @@ -72,10 +73,10 @@ try: except: if not audit_package_warned: audit_package_warned = True - print "Install the audit-libs-python package to get syscall names.\n" \ - "For example:\n # apt-get install python-audit (Ubuntu)" \ - "\n # yum install audit-libs-python (Fedora)" \ - "\n etc.\n" + print("Install the audit-libs-python package to get syscall names.\n" + "For example:\n # apt-get install python-audit (Ubuntu)" + "\n # yum install audit-libs-python (Fedora)" + "\n etc.\n") def syscall_name(id): try: