Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1866602imu; Thu, 17 Jan 2019 04:42:15 -0800 (PST) X-Google-Smtp-Source: ALg8bN6maOVR/R3x1SoQrGvUB0m4c3daBOUirgU1o0lbzz8BQl7o4RkfP6r1toahmAHog/5TFQWG X-Received: by 2002:a62:509b:: with SMTP id g27mr14908102pfj.48.1547728935257; Thu, 17 Jan 2019 04:42:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547728935; cv=none; d=google.com; s=arc-20160816; b=kUh3y8rrRt9uhvCQgMg1dAWNdqmlxhwtZLoX7cGwbF1YAUEI/UM0wYgynq+urAWHfk BPo31RNPfnlLBQZa05wV01CKSEEb/3pz0FSbJhHcedGtkuMFMRUIfBKd3tPrOQWlcdv4 QRmd2W5owlV14y63DCupZ4S5cmZOuvEp4zzjaLIagSVIiV0TLGtsV5Oobkwm46XF/F9L ue9tNCasALjmubcgYXkQRYu9Jr5p1a2SPlEHa3FIeZTTV6e6IFnejoW75Cgh8Tjz8FpH lQNNe0IkXyjMfIQc/6AyXH9ff3TU2UPsKlW0ft0Ind2eJY1vhBUFW048tw3BJM6wGAz2 jebw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:references:in-reply-to:date :subject:cc:to:from; bh=651Ju/g6ydbk/m8S2mBTm3GhqYfjsCObrh/bxtZMAfI=; b=YWyC8yVhHHNnSk3zMJeyRN+KPfuujiuuymzRrZgnn2/cTzCxKre3v0qnsxQvEMfnN0 6AET5xpC/jki9KBo0Zz2PQGZXuL2TN70Np45u1aEtEVIWeYBiJJ6ryzbyDMD6BV/NhQ8 1PHczlhwuaOcNhwgXAHx9LaT1WQteX5IoGKSCGkghGtQalnyF8aAQmFBOCBMif2gjB7Q 4o5fotihLnZpO0u2nqz6iA9iBmlbEmbvEQFqdSi3B7p3N1Z2lvI51PY5i4LF+QTLO5r5 hguCj7JwNQyBEpU9vPOmtkGeCJalCwP/2VLym6mwn96TvWTZFjecnrEiduFwGUD8+bGh ixqA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g12si1646229pla.104.2019.01.17.04.41.59; Thu, 17 Jan 2019 04:42:15 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729401AbfAQJqi (ORCPT + 99 others); Thu, 17 Jan 2019 04:46:38 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:55820 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727906AbfAQJqf (ORCPT ); Thu, 17 Jan 2019 04:46:35 -0500 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id x0H9japE104942 for ; Thu, 17 Jan 2019 04:46:34 -0500 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2q2mnd6xht-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 17 Jan 2019 04:46:34 -0500 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 17 Jan 2019 09:46:31 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 17 Jan 2019 09:46:28 -0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x0H9kRun50266258 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 17 Jan 2019 09:46:27 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 859D011C054; Thu, 17 Jan 2019 09:46:27 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 25CD811C058; Thu, 17 Jan 2019 09:46:26 +0000 (GMT) Received: from oc1548405160.ibm.com (unknown [9.124.35.202]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Thu, 17 Jan 2019 09:46:25 +0000 (GMT) From: Seeteena Thoufeek To: peterz@infradead.org, mingo@redhat.com, acme@kernel.org, alexander.shishkin@linux.intel.com, jolsa@redhat.com, namhyung@kernel.org, linux-kernel@vger.kernel.org Cc: s1seetee@linux.vnet.ibm.com Subject: [PATCH v2] perf scripts python: Add Python 3 support to syscall-counts.py Date: Thu, 17 Jan 2019 15:15:43 +0530 X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1547718344-27382-1-git-send-email-s1seetee@linux.vnet.ibm.com> References: <1547718344-27382-1-git-send-email-s1seetee@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19011709-0008-0000-0000-000002B2361F X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19011709-0009-0000-0000-0000221E5294 Message-Id: <1547718344-27382-16-git-send-email-s1seetee@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-01-17_03:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901170072 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Support both Python 2 and Python 3 in syscall-counts.py. ``print`` is now a function rather than a statement. This should have no functional change. Fix lambda syntax error Signed-off-by: Seeteena Thoufeek Reviewed-by: Ravi Bangoria --- tools/perf/scripts/python/syscall-counts.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tools/perf/scripts/python/syscall-counts.py b/tools/perf/scripts/python/syscall-counts.py index e66a773..6ca67bd 100644 --- a/tools/perf/scripts/python/syscall-counts.py +++ b/tools/perf/scripts/python/syscall-counts.py @@ -4,6 +4,7 @@ # # Displays system-wide system call totals, broken down by syscall. # If a [comm] arg is specified, only syscalls called by [comm] are displayed. +from __future__ import print_function import os import sys @@ -28,7 +29,7 @@ if len(sys.argv) > 1: syscalls = autodict() def trace_begin(): - print "Press control+C to stop and show the summary" + print("Press control+C to stop and show the summary") def trace_end(): print_syscall_totals() @@ -51,14 +52,14 @@ def syscalls__sys_enter(event_name, context, common_cpu, def print_syscall_totals(): if for_comm is not None: - print "\nsyscall events for %s:\n\n" % (for_comm), + print("\nsyscall events for %s:\n\n" % (for_comm)), else: - print "\nsyscall events:\n\n", + print("\nsyscall events:\n\n"), - print "%-40s %10s\n" % ("event", "count"), - print "%-40s %10s\n" % ("----------------------------------------", \ - "-----------"), + print("%-40s %10s\n" % ("event", "count")), + print("%-40s %10s\n" % ("----------------------------------------", \ + "-----------")), - for id, val in sorted(syscalls.iteritems(), key = lambda(k, v): (v, k), \ + for id, val in sorted(syscalls.iteritems(), key = lambda k_v: (k_v[1], k_v[0]), \ reverse = True): - print "%-40s %10d\n" % (syscall_name(id), val), + print("%-40s %10d\n" % (syscall_name(id), val)), -- 1.8.3.1