Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1215300imu; Wed, 16 Jan 2019 15:00:25 -0800 (PST) X-Google-Smtp-Source: ALg8bN7dfFySFEIamMyfORQZB/Cur8XWKHa8Q5n0PZStFcsqhuDG95D0kA5v5yoX0LGAcDpskJmP X-Received: by 2002:a17:902:5a4d:: with SMTP id f13mr12694113plm.49.1547679625014; Wed, 16 Jan 2019 15:00:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547679625; cv=none; d=google.com; s=arc-20160816; b=mZjiAHm9mv3ts50lAARZ5uDA7SkQbAsVKVL3iKz3J4GUmV+xz46W7qkQDxNzIxWdC+ SdqeQEbVYqfLd/lKowPIeJBusgUcCbjnnq+J2t6JGuBtBbjZBOm+NuppyQdbtzkrOOrs wTP1Ivj5NTSKyWgLd8n377o95cwbRFn70vi+/9E6ecOUmYBhZL1LmVtjp4M5iFwk+CJM ZJ2TNR9ZrT/LiGFHtvOaWHRiMdNQRG3uOjLb3gT4VOK3Vd9frBwYs6d3R8W3GD3N9O/B 4KjTNLH3hkCcrcTu313z1bXAVjeHWHt5VEtAuAYqklBBqtqvsMkCZ/7G7N1ZrenHnn5X dogg== 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=Pz5t7vYn9O+0w9DONmXMyFUC3A4nt1h/C/Q/v/0CAJk=; b=YoOC1aP33pAWIMSDTzCOumGo4PINeLeAvSlGUxhdirMpEAjavr6W7KkU0T7vkmhK7p O1ksz53ExdCyKcE1yolJZTpAZCpJVxuguqioR2kyvyPQRlPycBSJo3Wc1e350/MUggzt odT4j4ERW84DXV6hhZhU6CuKl9WeLsFMCrIZxVgty6N8JaImzeP1X43hPae9NT8PEUnk GKkQXHRQKQ/c9t4x6yMjNiC19sabcX/j0SJDai8Z5Xwa67eWg+TTXkSdsbcj+4k32pRP rOjZ1MZFWzWJD3Xc7pxtup6cP+Tqwio8ExXOPrqqBUIqdBuQ3QmFjBIhUXxs9q7BnxWW jDmw== 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 c5si6726582pgq.434.2019.01.16.15.00.06; Wed, 16 Jan 2019 15:00:24 -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 S2405588AbfAPQYw (ORCPT + 99 others); Wed, 16 Jan 2019 11:24:52 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:41196 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731019AbfAPQYu (ORCPT ); Wed, 16 Jan 2019 11:24:50 -0500 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id x0GGJulL084263 for ; Wed, 16 Jan 2019 11:24:49 -0500 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0b-001b2d01.pphosted.com with ESMTP id 2q25k8fbeh-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 16 Jan 2019 11:24:49 -0500 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 16 Jan 2019 16:24:47 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 16 Jan 2019 16:24:44 -0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x0GGOhnc59048176 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 16 Jan 2019 16:24:43 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2C13142047; Wed, 16 Jan 2019 16:24:43 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7D85D4203F; Wed, 16 Jan 2019 16:24:40 +0000 (GMT) Received: from oc1548405160.ibm.com (unknown [9.85.72.239]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Wed, 16 Jan 2019 16:24:40 +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, ravi.bangoria@linux.ibm.com Subject: [PATCH] perf scripts python: Add Python 3 support to syscall-counts-by-pid.py Date: Wed, 16 Jan 2019 21:53:43 +0530 X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1547655825-28754-1-git-send-email-s1seetee@linux.vnet.ibm.com> References: <1547655825-28754-1-git-send-email-s1seetee@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19011616-4275-0000-0000-000003000E5D X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19011616-4276-0000-0000-0000380E3054 Message-Id: <1547655825-28754-15-git-send-email-s1seetee@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-01-16_06:,, 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-1901160132 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-by-pid.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-by-pid.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/perf/scripts/python/syscall-counts-by-pid.py b/tools/perf/scripts/python/syscall-counts-by-pid.py index daf314c..f3f17fd 100644 --- a/tools/perf/scripts/python/syscall-counts-by-pid.py +++ b/tools/perf/scripts/python/syscall-counts-by-pid.py @@ -31,7 +31,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() @@ -55,20 +55,20 @@ 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 by comm/pid:\n\n", + print("\nsyscall events by comm/pid:\n\n"), - print "%-40s %10s\n" % ("comm [pid]/syscalls", "count"), - print "%-40s %10s\n" % ("----------------------------------------", \ - "----------"), + print("%-40s %10s\n" % ("comm [pid]/syscalls", "count")), + print("%-40s %10s\n" % ("----------------------------------------", \ + "----------")), comm_keys = syscalls.keys() for comm in comm_keys: pid_keys = syscalls[comm].keys() for pid in pid_keys: - print "\n%s [%d]\n" % (comm, pid), + print("\n%s [%d]\n" % (comm, pid)), id_keys = syscalls[comm][pid].keys() for id, val in sorted(syscalls[comm][pid].iteritems(), \ - key = lambda(k, v): (v, k), reverse = True): - print " %-38s %10d\n" % (syscall_name(id), val), + key = lambda k_v: (k_v[1], k_v[0]), reverse = True): + print(" %-38s %10d\n" % (syscall_name(id), val)), -- 1.8.3.1