Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp477668ybf; Fri, 28 Feb 2020 01:36:54 -0800 (PST) X-Google-Smtp-Source: APXvYqz9nXNAtZ6mzE1TCphYEqAaA2YwILIUSvPIPkNxx1qQoaejSt/Sqe63NS2N2+jgs8hq2dVX X-Received: by 2002:aca:f405:: with SMTP id s5mr2435373oih.93.1582882614261; Fri, 28 Feb 2020 01:36:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582882614; cv=none; d=google.com; s=arc-20160816; b=ycPHKk/x6bAGve0lvQY62lOKTRi3EyCI7M36P1STYjSgJ6Y0qjS979Az2hbpAWGPAh f/eduKlnWcvy/IoyNkP7gGkZe5PaU9bxg6znl6cMRdzULSP/2oh7VVhVNPq+Juup6pjh /1jHGe6Q99faIeLSEI2CC3PJtB9fk7HjuagavW0OK4DSHlnrpaLVpnXLtsL2gVuQ+gCl GuBNGMToOlOwLGSe1DoXFAG4Op4f7kQwZVSxoYV7ySFof8Hefbn7aRuUA9gRvROqcVsz zR66QaRZtNN3Ax2v+0GfoMAcaoqx+JWovz169VBNlpjX9YsxvoobqG54W36BFJI0gsZ4 He6g== 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=AGSGKQh6qQ3jPOjEXUDSzSa7i+pD8FCse8yJ7XiK0Hs=; b=Rs/jQ4s8LrPNSsfKkXNNEmILvSu4dcCiaNf22FviZ0ohG7M1YyFwz95MELeonj8Vfh OrFfYHo3r/imi0cYa9VsYYhpSMzKmVIagoGUwPBHF75hFUvDbhJfYrWrA/whiQ+1ohHc OpEFtQiZfhXHYZdI2ao5LR6WPYzo25jIgy9rAxKWu3a5g8pHzQNJjHPEjwKQ/ODjBZeZ ee/Z/2Q20ZyeJYPUojlp6PaOcKHqDsNDqDLJ3ByqqnzyC86z6zJ4DgFgXNyc8jsDGDsQ hjfOZmfssSPYCe3ngItNDun4ZJdyPZRL4XPRO0/l8c4YpetRINIE5/ju2LegLZDBNVPZ oXsg== 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 h21si1156206otr.235.2020.02.28.01.36.42; Fri, 28 Feb 2020 01:36:54 -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 S1726940AbgB1Jg1 convert rfc822-to-8bit (ORCPT + 99 others); Fri, 28 Feb 2020 04:36:27 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:26900 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726875AbgB1Jg1 (ORCPT ); Fri, 28 Feb 2020 04:36:27 -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-455-HGP-EOL_MOK3CoN6k2mXyQ-1; Fri, 28 Feb 2020 04:36:22 -0500 X-MC-Unique: HGP-EOL_MOK3CoN6k2mXyQ-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 CADA48017CC; Fri, 28 Feb 2020 09:36:20 +0000 (UTC) Received: from krava.redhat.com (unknown [10.36.118.62]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3A2938C09C; Fri, 28 Feb 2020 09:36:17 +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: [PATCHv3 0/5] perf expr: Add flex scanner Date: Fri, 28 Feb 2020 10:36:11 +0100 Message-Id: <20200228093616.67125-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? v3 changes: - keep the EXPR_MAX_OTHER not too high (Andi) - add normalize call to flexer, so we have all symbols covered [kajoljain] 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 | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ tools/perf/util/expr.y | 185 +++++++++++++++++++++---------------------------------------------------------------------------------------------------- tools/perf/util/stat-shadow.c | 4 +-- 7 files changed, 276 insertions(+), 168 deletions(-) create mode 100644 tools/perf/util/expr.c create mode 100644 tools/perf/util/expr.l