Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2180917ybv; Mon, 24 Feb 2020 00:30:04 -0800 (PST) X-Google-Smtp-Source: APXvYqysyHk5QtwnaQ2rmFpUb28oECF3ZnzYOT40GxRlsVasSmLSXsW37PRl+1rNByUsNlwnrCoW X-Received: by 2002:aca:3f43:: with SMTP id m64mr11309774oia.165.1582533004660; Mon, 24 Feb 2020 00:30:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582533004; cv=none; d=google.com; s=arc-20160816; b=g6/v94JzR6dkzbgwZm3FTH2kkj1nCdoeHdYI2LMZfcan1S15dvbppvTZfF4RJU0YC4 tU4VsVODMNst2fYwKHj6d1DUIVxrWo2T8wlTNroYSHS0i1NX/zLIO+u8SW8iSv5NSKnY F+N6M0J1M2F/kVG2dvpT58h2rEeu6cDfXPnehY8JT9FAGuXV6wSAE0nCjJHr77edytzk HUpuSg37+03cRbJxxiyDF6fg7fg0QEaR83JGY2rZ0hqpqjDAuYhOffhKW1iGxJL3riEA iz4k0xdpygKxJAgCJK0KwcH5XBXv9w1FPV/HhImSez/JCSOayGZQw0dbEtKhjhBBpV3z m2/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=X/ywHCW269gCsIsPAtA4lTDEDowLCZPDmqF+sAt6TEM=; b=q14mUO7nzs2U/45nqHAE1WX3RdZXIVESRgIU1hGwHBLtrYpXnyR/fqfa/bd5txhjf0 YcQDvGO1SJKH23MSTZ5Mh8HClaZSRrCwJEVX2fOeNZgg05uMSIxx4OTuUiZ1XBNH6Lnr lFs0e9rNxYr78F3YBkQXljLpdC2TooYo6lgGkeN2jW14dZIH5doIxp7lIv+UhoP2Mqg9 ROPswhhQdJ9MVPYRHToXygHA3riRCpJcRMsU+sdcMgUcIGp09idnLLHN9m23y/Y/wIll TjNhHqqTB1l7icgaa2WKLcPjSR7Y2tKoWy1C3HTi+dvb5Pt3qTy3D5rdWg9DH1Uh1VWX aIVg== 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 9si4456355oir.71.2020.02.24.00.29.44; Mon, 24 Feb 2020 00:30:04 -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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727260AbgBXI3a convert rfc822-to-8bit (ORCPT + 99 others); Mon, 24 Feb 2020 03:29:30 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:37428 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726687AbgBXI3a (ORCPT ); Mon, 24 Feb 2020 03:29:30 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-290-z-P-SpuqO9aP6hr7_tNl8Q-1; Mon, 24 Feb 2020 03:29:25 -0500 X-MC-Unique: z-P-SpuqO9aP6hr7_tNl8Q-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 36FA113E2; Mon, 24 Feb 2020 08:29:23 +0000 (UTC) Received: from krava.redhat.com (ovpn-205-68.brq.redhat.com [10.40.205.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id DD7BE85781; Mon, 24 Feb 2020 08:29:19 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan , Ravi Bangoria , Andi Kleen , Kajol Jain , John Garry Subject: [PATCHv2 0/5] perf expr: Add flex scanner Date: Mon, 24 Feb 2020 09:29:13 +0100 Message-Id: <20200224082918.58489-1-jolsa@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org hi, while preparing changes for user defined metric expressions I also moved the expression manual parser to flex. The reason is to have an easy and reasonable way to support and parse multiple user-defined metric expressions from command line or file. I was posponing the change, but I just saw another update to the expr manual scanner (from Kajol Jain), so cherry picked just the expr flex code changes to get it out. Kajol Jain, I think it should ease up your change for unknown values marked by '?'. Would you consider rebasing your changes on top of this? v2 changes: - handle special chars properly - fix return value for expr__parse Available also in: git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git perf/metric_flex thanks, jirka --- Jiri Olsa (5): perf expr: Add expr.c object perf expr: Move expr lexer to flex perf expr: Increase EXPR_MAX_OTHER perf expr: Straighten expr__parse/expr__find_other interface perf expr: Make expr__parse return -1 on error tools/perf/tests/expr.c | 10 +++--- tools/perf/util/Build | 11 ++++++- tools/perf/util/expr.c | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ tools/perf/util/expr.h | 8 ++--- tools/perf/util/expr.l | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++ tools/perf/util/expr.y | 208 ++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------- tools/perf/util/stat-shadow.c | 4 +-- 7 files changed, 272 insertions(+), 168 deletions(-) create mode 100644 tools/perf/util/expr.c create mode 100644 tools/perf/util/expr.l