Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2412970ybv; Fri, 21 Feb 2020 15:21:07 -0800 (PST) X-Google-Smtp-Source: APXvYqzEAel/h+cK3JPUGuy9OQ1IYP5gfLZdd6UfO7PsCLhDep+q3rxyqiFmtY0yh4w20v4YHFwR X-Received: by 2002:aca:1c09:: with SMTP id c9mr4191239oic.85.1582327267494; Fri, 21 Feb 2020 15:21:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582327267; cv=none; d=google.com; s=arc-20160816; b=p6EwVhkhyIMq6ZYsAbxOssVxut/3J56BgzgtdG4chhu83LDNX1ELOp+9fMqwh0Ub0k PMwo4MhhF56cSPuFPMnUBnmrHwSBqtHaKVGIoxPN0lnwMNrWFwdSPpvHLH/uedls1hm/ iJ+j4DACWdJefY99rFSrqyt8igU+6TegxMMsYAAYVnRRQQ/ts2x+a4Ns344C9l6+Ou9L lgOKcszKS+4UlhdysTZRivheicZdJKAdNoJdBZmj2Vl+vq5vqUucek9d3+B2ptLhtjZY RS2OxrJRT3zaj3AND+Mk6TWvC89erjgJa2cwv2FEuBZb7XXKuz3eAVvyFi9jpPAnBgv6 G6Bg== 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=pDJYqwOkNDpJFiWrl7DEHKgn8yi8+6W/gkt+Cjcdles=; b=nEtgCowtBWiLZ2s6bo2fiBiATncHIxQPyuaBinOrmjQUYuGLlmc9AxHs77HaWBM/DY wB99UuU6cFJRiNPA03J7SoNOjyEj60R0jP6s7tpHKLJn4o5RvgcC1n1EqymiNZWjr06p wMJtokQVuXv90KRMaIEUD79TJzYkEqf9cHlPIsV1DkxQHFwZdLCp8zkq0/OCafEYb8d9 g0CDCFoKIdDwDzPWfEAkXn+vhLnehs7XryCfpoTLagzQzWF5P+t/UA50cm3PoSa2ZBmv 48AL/7gt/g2LRYne9k9MidtUnk4Lmyg4Cq/pJJmIvJJ8ipDPcsexpzCtFqfP7zrHLBHt dPjw== 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 l139si1474114oih.233.2020.02.21.15.20.55; Fri, 21 Feb 2020 15:21:07 -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 S1729397AbgBUXTr convert rfc822-to-8bit (ORCPT + 99 others); Fri, 21 Feb 2020 18:19:47 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:33312 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726290AbgBUXTq (ORCPT ); Fri, 21 Feb 2020 18:19:46 -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-92-Xc3R4icMNLag4_uDGsbNuQ-1; Fri, 21 Feb 2020 18:19:41 -0500 X-MC-Unique: Xc3R4icMNLag4_uDGsbNuQ-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 B36D7100550E; Fri, 21 Feb 2020 23:19:39 +0000 (UTC) Received: from krava.redhat.com (ovpn-204-57.brq.redhat.com [10.40.204.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 670AE60499; Fri, 21 Feb 2020 23:19:36 +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: [RFC 0/4] perf expr: Add flex scanner Date: Sat, 22 Feb 2020 00:19:31 +0100 Message-Id: <20200221231935.735145-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? Available also in: git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git perf/metric_flex thanks, jirka --- Jiri Olsa (4): 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 tools/perf/tests/expr.c | 6 ++-- tools/perf/util/Build | 11 +++++++- tools/perf/util/expr.c | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ tools/perf/util/expr.h | 8 ++---- tools/perf/util/expr.l | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tools/perf/util/expr.y | 185 +++++++++++++++++++++---------------------------------------------------------------------------------------------------- tools/perf/util/stat-shadow.c | 4 +-- 7 files changed, 242 insertions(+), 166 deletions(-) create mode 100644 tools/perf/util/expr.c create mode 100644 tools/perf/util/expr.l