From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757163AbcIOW2Y (ORCPT ); Thu, 15 Sep 2016 18:28:24 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:57483 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756417AbcIOWZ7 (ORCPT ); Thu, 15 Sep 2016 18:25:59 -0400 From: Sukadev Bhattiprolu To: Arnaldo Carvalho de Melo Cc: peterz@infradead.org, maddy@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org, Subject: [PATCH v21 14/19] perf, tools, jevents: Handle header line in mapfile Date: Thu, 15 Sep 2016 15:24:51 -0700 X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1473978296-20712-1-git-send-email-sukadev@linux.vnet.ibm.com> References: <1473978296-20712-1-git-send-email-sukadev@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16091522-0028-0000-0000-0000059EC6DD X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00005767; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000185; SDB=6.00758095; UDB=6.00359730; IPR=6.00531733; BA=6.00004731; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00012685; XFM=3.00000011; UTC=2016-09-15 22:25:57 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16091522-0029-0000-0000-00002F48C126 Message-Id: <1473978296-20712-15-git-send-email-sukadev@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-09-15_10:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609020000 definitions=main-1609150298 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andi Kleen To work with existing mapfiles, assume that the first line in 'mapfile.csv' is a header line and skip over it. Signed-off-by: Andi Kleen Signed-off-by: Sukadev Bhattiprolu Acked-by: Jiri Olsa Acked-by: Ingo Molnar --- Changelog[v2] All architectures may not use the "Family" to identify. So, assume first line is header. --- tools/perf/pmu-events/jevents.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c index f550cad..9cdfbaa 100644 --- a/tools/perf/pmu-events/jevents.c +++ b/tools/perf/pmu-events/jevents.c @@ -492,7 +492,12 @@ static int process_mapfile(FILE *outfp, char *fpath) print_mapping_table_prefix(outfp); - line_num = 0; + /* Skip first line (header) */ + p = fgets(line, n, mapfp); + if (!p) + goto out; + + line_num = 1; while (1) { char *cpuid, *version, *type, *fname; @@ -536,8 +541,8 @@ static int process_mapfile(FILE *outfp, char *fpath) fprintf(outfp, "},\n"); } +out: print_mapping_table_suffix(outfp); - return 0; } -- 1.8.3.1