Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1710466imu; Thu, 17 Jan 2019 01:53:48 -0800 (PST) X-Google-Smtp-Source: ALg8bN464Kk5bK1iJvPkF4HUoje6Y9HfHpjdmXOFeFLimw5ZjHfflyZsbCbdzAeMz+xaRG3+6HMM X-Received: by 2002:a63:5ec6:: with SMTP id s189mr12302337pgb.357.1547718828459; Thu, 17 Jan 2019 01:53:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547718828; cv=none; d=google.com; s=arc-20160816; b=tDrtG04C8mvHRgUDqY0eZVFDbUkOZt3NmYaYSP56BQIfIYpiLLYgnA5iCxbv3gUYey QhT9BURd0dkrKTfNjG8Sny3L5dxE4iAl6D454TNw0agVFY6ESMBazR6kOphl6F2XEKRN DPu+IPfvFhEm4NTayomCJQZ6l8g4nwnDvU0sHTzoOoNibc5aN4TRNY/65cgWY1EnYZpz LFBY85W9o8PLIWG2RwbBgkBvDE62BPHSb6cjb1W1MGbtpUg1NjwjqVZcAocp45M2PI6/ R9D7DiikJlUhxUjjQOUtEIYZY7CV3iijIIo2p5+n5taqvyrvhUJt0p9rZlLIy04zNru/ u8bA== 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=R0acKFu0ixN8X1hcMdJa5v/6Fc/DUfC44EwATIUgJhs=; b=OVo5VNN/IHSRgIXYq/htAswj3BPrLMHy5rxBx0sRShiyGGoGDsghUt78EMNs+dy9Y4 IFxPdDQLFMZyxGCpHRFZLoy6dP41OroK4rExGbpxHsiYmgCrC5lb7hc86/LqTuGVQqeV uVjFTbDN+aGM8Ifpe3yL30aS8TEAUiYm8rbdyujDnXygpTa53pWfnGX2fk50O3D5qFJF 3+uDSnHBoFI4scES4ROQCrn71nxq/6PNXS5rkcnS223wvNQFMFpNQoHvsHrDEdV3ltal tg8ZsDLWWB8PiGyj8BQE6UZ4HU0RAMNshZwAUDbPhZshLauZ/LHMfAKje8Yg0h/UX/D1 ojxQ== 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 n128si1239858pga.423.2019.01.17.01.53.33; Thu, 17 Jan 2019 01:53:48 -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 S1728988AbfAQJrQ (ORCPT + 99 others); Thu, 17 Jan 2019 04:47:16 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:34926 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728872AbfAQJqF (ORCPT ); Thu, 17 Jan 2019 04:46:05 -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 x0H9iEg9041300 for ; Thu, 17 Jan 2019 04:46:04 -0500 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0b-001b2d01.pphosted.com with ESMTP id 2q2nt0mc3r-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 17 Jan 2019 04:46:03 -0500 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 17 Jan 2019 09:46:02 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp05.uk.ibm.com (192.168.101.135) 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:45:59 -0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x0H9jw4L62521392 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 17 Jan 2019 09:45:58 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6B12511C05B; Thu, 17 Jan 2019 09:45:58 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0B36B11C04C; Thu, 17 Jan 2019 09:45:57 +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:45:56 +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 failed-syscalls-by-pid.py Date: Thu, 17 Jan 2019 15:15:32 +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-0020-0000-0000-00000307A7E5 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19011709-0021-0000-0000-00002158C862 Message-Id: <1547718344-27382-5-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 failed-syscalls-by-pid.py. ``print`` is now a function rather than a statement. This should have no functional change. Fixes lambda syntax error. Signed-off-by: Seeteena Thoufeek Reviewed-by: Ravi Bangoria Please enter the commit message for your changes. Lines starting --- tools/perf/scripts/python/failed-syscalls-by-pid.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/tools/perf/scripts/python/failed-syscalls-by-pid.py b/tools/perf/scripts/python/failed-syscalls-by-pid.py index cafeff3..a174755 100644 --- a/tools/perf/scripts/python/failed-syscalls-by-pid.py +++ b/tools/perf/scripts/python/failed-syscalls-by-pid.py @@ -4,6 +4,7 @@ # # Displays system-wide failed system call totals, broken down by pid. # If a [comm] arg is specified, only syscalls called by [comm] are displayed. +from __future__ import print_function import os import sys @@ -32,7 +33,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_error_totals() @@ -57,22 +58,22 @@ def syscalls__sys_exit(event_name, context, common_cpu, def print_error_totals(): if for_comm is not None: - print "\nsyscall errors for %s:\n\n" % (for_comm), + print("\nsyscall errors for %s:\n\n" % (for_comm)), else: - print "\nsyscall errors:\n\n", + print("\nsyscall errors:\n\n"), - print "%-30s %10s\n" % ("comm [pid]", "count"), - print "%-30s %10s\n" % ("------------------------------", \ - "----------"), + print("%-30s %10s\n" % ("comm [pid]", "count")), + print("%-30s %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 in id_keys: - print " syscall: %-16s\n" % syscall_name(id), + print(" syscall: %-16s\n" % syscall_name(id)), ret_keys = syscalls[comm][pid][id].keys() - for ret, val in sorted(syscalls[comm][pid][id].iteritems(), key = lambda(k, v): (v, k), reverse = True): - print " err = %-20s %10d\n" % (strerror(ret), val), + for ret, val in sorted(syscalls[comm][pid][id].iteritems(), key = lambda k_v: (k_v[1], k_v[0]), reverse = True): + print(" err = %-20s %10d\n" % (strerror(ret), val)), -- 1.8.3.1