Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1813297imu; Thu, 17 Jan 2019 03:45:49 -0800 (PST) X-Google-Smtp-Source: ALg8bN6y5S6z+C12s7+rCva6gZIndtoEGDoSw5cqglgD7RJc55AHF127SkAaU18vDM1pU1qa0vFZ X-Received: by 2002:a62:8c11:: with SMTP id m17mr14639944pfd.224.1547725549467; Thu, 17 Jan 2019 03:45:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547725549; cv=none; d=google.com; s=arc-20160816; b=bWiIWd8KjLr4ozckGLowWlOpCWCLyc477aoYN2T8lHgv892tLotgiaVsa1qZxPN3Ua k8ibzDLeOipRphAcXXxcVti1r535RCqCRMrTVpjZY2r7XjOCNSJuna/xNDbQ4W1Fr8HC 4roCkACo5H7riVh/9iSIcseDMMPZml7lqh5IGJUZ8YJcvgqNGoDInusLDmG7mRQQf0Gu mbI0ooVUNp1n/o0LuVihd8WxIhT9B4oCTBPUhyC02GpwiRolAHyyQZoicE22RYhCKouM W9axi9zgnyRKKYPi+6wYV8l9AlNOScYZLQUx9aDzzJ80FbZOs6/i6YApE6AK9FPHN8mU UOrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=61dig+D7L+aPxBO3m+QnU6/y9+ZNebIuKvkjA4yMa18=; b=NDiNCV7FKmUIw+YBfVAsIrJCAPuB8KEeTFCL+ZUCSuZA+vpXceWaoCOK4Ck/lBFx5T gDQX+TabnDS+85g2nIZwQKrF8Q6siEJenuKiHIBiLXmYyglZyLuSXPi4yehBPRBNDm9U GmAARMk+2pziHO/V+BgtIYalIWoUDi7xIXm+K0uw9RzbpyxltGHzBgTEri7G5VRCLToG 9LMcf6QZJN2BYgBr6xa0FbnbD5KXkCl59EqcA91XEfowmeqHFsQxDWy1UG/WTreOdTIv KQOKDREfvANaHLaKlrVLtFtKVwuR6S8zQKPTNDEAa5bU9MTyHKocxfbnn5+IPfrC7MoC CmIg== 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 m2si336868pgs.96.2019.01.17.03.45.33; Thu, 17 Jan 2019 03:45:49 -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 S1727704AbfAQJqB (ORCPT + 99 others); Thu, 17 Jan 2019 04:46:01 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:59184 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727410AbfAQJp6 (ORCPT ); Thu, 17 Jan 2019 04:45:58 -0500 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id x0H9iBOC095416 for ; Thu, 17 Jan 2019 04:45:57 -0500 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2q2ppyhv4h-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 17 Jan 2019 04:45:56 -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:45:55 -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:45:48 -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 x0H9jlLr61866024 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 17 Jan 2019 09:45:47 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B6F3811C050; Thu, 17 Jan 2019 09:45:47 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 55E9111C04C; Thu, 17 Jan 2019 09:45:46 +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:46 +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 check-perf-trace.py Date: Thu, 17 Jan 2019 15:15:28 +0530 X-Mailer: git-send-email 1.8.3.1 X-TM-AS-GCONF: 00 x-cbid: 19011709-0008-0000-0000-000002B23609 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19011709-0009-0000-0000-0000221E5279 Message-Id: <1547718344-27382-1-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 check-perf-trace.py. ``print`` is now a function rather than a statement. This should have no functional change. Fix indentation issue, replace spaces with tab Signed-off-by: Seeteena Thoufeek Reviewed-by: Ravi Bangoria --- tools/perf/scripts/python/check-perf-trace.py | 33 ++++++++++++++------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/tools/perf/scripts/python/check-perf-trace.py b/tools/perf/scripts/python/check-perf-trace.py index 334599c..91fc499 100644 --- a/tools/perf/scripts/python/check-perf-trace.py +++ b/tools/perf/scripts/python/check-perf-trace.py @@ -7,6 +7,7 @@ # events, etc. Basically, if this script runs successfully and # displays expected results, Python scripting support should be ok. +from __future__ import print_function import os import sys @@ -19,7 +20,7 @@ from perf_trace_context import * unhandled = autodict() def trace_begin(): - print "trace_begin" + print("trace_begin") pass def trace_end(): @@ -31,10 +32,10 @@ def irq__softirq_entry(event_name, context, common_cpu, print_header(event_name, common_cpu, common_secs, common_nsecs, common_pid, common_comm) - print_uncommon(context) + print_uncommon(context) - print "vec=%s\n" % \ - (symbol_str("irq__softirq_entry", "vec", vec)), + print("vec=%s\n" % \ + (symbol_str("irq__softirq_entry", "vec", vec))), def kmem__kmalloc(event_name, context, common_cpu, common_secs, common_nsecs, common_pid, common_comm, @@ -43,13 +44,13 @@ def kmem__kmalloc(event_name, context, common_cpu, print_header(event_name, common_cpu, common_secs, common_nsecs, common_pid, common_comm) - print_uncommon(context) + print_uncommon(context) - print "call_site=%u, ptr=%u, bytes_req=%u, " \ + print("call_site=%u, ptr=%u, bytes_req=%u, " \ "bytes_alloc=%u, gfp_flags=%s\n" % \ (call_site, ptr, bytes_req, bytes_alloc, - flag_str("kmem__kmalloc", "gfp_flags", gfp_flags)), + flag_str("kmem__kmalloc", "gfp_flags", gfp_flags))), def trace_unhandled(event_name, context, event_fields_dict): try: @@ -58,25 +59,25 @@ def trace_unhandled(event_name, context, event_fields_dict): unhandled[event_name] = 1 def print_header(event_name, cpu, secs, nsecs, pid, comm): - print "%-20s %5u %05u.%09u %8u %-20s " % \ - (event_name, cpu, secs, nsecs, pid, comm), + print("%-20s %5u %05u.%09u %8u %-20s " % \ + (event_name, cpu, secs, nsecs, pid, comm)), # print trace fields not included in handler args def print_uncommon(context): - print "common_preempt_count=%d, common_flags=%s, common_lock_depth=%d, " \ + print("common_preempt_count=%d, common_flags=%s, common_lock_depth=%d, " \ % (common_pc(context), trace_flag_str(common_flags(context)), \ - common_lock_depth(context)) + common_lock_depth(context))) def print_unhandled(): keys = unhandled.keys() if not keys: return - print "\nunhandled events:\n\n", + print("\nunhandled events:\n\n"), - print "%-40s %10s\n" % ("event", "count"), - print "%-40s %10s\n" % ("----------------------------------------", \ - "-----------"), + print("%-40s %10s\n" % ("event", "count")), + print("%-40s %10s\n" % ("----------------------------------------", \ + "-----------")), for event_name in keys: - print "%-40s %10d\n" % (event_name, unhandled[event_name]) + print("%-40s %10d\n" % (event_name, unhandled[event_name])) -- 1.8.3.1