Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp339442pxb; Thu, 23 Sep 2021 00:49:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjSJrM34TZyRpIjiw0X6rJRPG+4IddkpYjoR0zlqylJpIZj4c6rqjencXR4aPMEbLPnJM4 X-Received: by 2002:a17:906:3a4d:: with SMTP id a13mr3589947ejf.220.1632383399704; Thu, 23 Sep 2021 00:49:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632383399; cv=none; d=google.com; s=arc-20160816; b=Q2Qo79Sa6WYGNknQIxTqwrXnnPXCrlTwvQV4SlhI5PeaNf+bEfQOtspr1FjHQn6uT+ 4Ftq6LAQwEN+lJkNG9rJQZe1utzDHGK6ujWpA3bW0m20RraNEFy7f9GV+AR8sw2gxcrB AJ6QX5X7sNvHBS2H//WTD510QNZU8YH6R4N7UYIyvjPqzmaWMG05RwMg7ij99n8MrgZZ cjqDneaoJa57QV3WQWBk3fMRqBGN5wQe4xGWmrje/p5FrTdgZkAs8twSCe4qzSyyIlwo jBEUQtFyZ/lFgjdxmliz18+1OkGvrFFCbRZSVjtQ3Sbta66rr1djNgN1caSa1P6RI/PK y5yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=8/vLHEatF56tRYYCixJ8mAYibrjQPYFCtQw+LEHly14=; b=fm9xZLrMhtI/vafF051rFEiWZKIEeRfp6FLMYyEYJu+vhhhdzCHpsZY5q8FPfHLLkg KYa1zCw8gtU2Fs0xdQfnufElZcjifCdgS/V8qsxvnMmp0iXVP2+cSLIMwOBHuLnb2gLt Aj+Gu/jv2DNDoZJ8I6y4Vw6L8SyzsHs+HdmMj5hZFGx6UMb6MAUb3DNwiuvVVf1SktAK 6c0gQ02TZg3FYa5HyWUdXoxw5ZQWr90OEGATQA3pU6sdHZGcgrkjIjOBLmxj7faF18F1 HsSulhkCI+bLJgNIKMCZBwoZY323umP9xLVZtGisw3qogvNlFTcsGGH7zKeeUuaYOLXJ foeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=gUDOjpMu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qw21si5168935ejc.356.2021.09.23.00.49.36; Thu, 23 Sep 2021 00:49:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=gUDOjpMu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239754AbhIWHsX (ORCPT + 99 others); Thu, 23 Sep 2021 03:48:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239793AbhIWHsO (ORCPT ); Thu, 23 Sep 2021 03:48:14 -0400 Received: from mail-qv1-xf49.google.com (mail-qv1-xf49.google.com [IPv6:2607:f8b0:4864:20::f49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D78D9C061756 for ; Thu, 23 Sep 2021 00:46:42 -0700 (PDT) Received: by mail-qv1-xf49.google.com with SMTP id w10-20020a0cb54a000000b0037a9848b92fso20362757qvd.0 for ; Thu, 23 Sep 2021 00:46:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=8/vLHEatF56tRYYCixJ8mAYibrjQPYFCtQw+LEHly14=; b=gUDOjpMu9NR33CwU3XttdZ64LFpA58kWGPBJQdBER5o3HnMNsP3eOqRijM67QvKUzB VAcOSaghYr2/ryY+u2UO3urQELtDAr4FRSAmTcSv4LIWiUfX6DXxrzkk+O8TkyY1y8Om AdyLMloA9JigBpp+3qXUfg/Gp8ZP3gzEdZdBFTDAnquI+7CGBvNqsZJWI+SJk1ymkmF8 wDzqg1wzdkDq/PElxw7IQTWSN3ocKApyH9RecNiSA6xa2Yb8yZrWvlw/4BXzRAxsTnCy nRXUU2r4eeGUdC3+kGe9nt4nEEKVpd5EJLVATb0VTOmeO3z4B5SeR1q0usWFWYLpVvWj TXTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=8/vLHEatF56tRYYCixJ8mAYibrjQPYFCtQw+LEHly14=; b=iLrjpNYaLYeII50eGd4kAmJDHFHsuWF0QfACmQFCg5WFzh/nC6KiXsqiYopnLv0B+d Lcg7TmZQkPq6HAcLZWjzcpeWg3r5t1RtW27nXMhZHFXiG7hA3UomHPz9pGvT/XmuHqbZ ENFQAhfjppm3nC9ENB2Nju2X3r3pviMnZ8gl6VQF70exN0S5yTZFI2uk8znBq3BDZPcF lgFUE5PdA3UfNWHeNqVuoIhrJb/EgnLk+qKkA1nPEP/67ouns2BY1riAosdNXZQiNWo+ nFZuxyROR4yOph1wCbGr1LTC3KdKiRAKeoTrr9YMZtoIwZxLhYQdfwpQ0+5JbGj6zxZP FFMA== X-Gm-Message-State: AOAM531/BA/Xxovn6mlhJ2SLlVNo7C6pYzO5T4r2rgFmxoq/oCep6Cxg ul8dFHAqRCfu+OfXtsHH419PUguhzTvC X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:202:d3ff:e8f7:11f4:c738]) (user=irogers job=sendgmr) by 2002:a05:6214:1331:: with SMTP id c17mr3155570qvv.56.1632383202012; Thu, 23 Sep 2021 00:46:42 -0700 (PDT) Date: Thu, 23 Sep 2021 00:46:06 -0700 In-Reply-To: <20210923074616.674826-1-irogers@google.com> Message-Id: <20210923074616.674826-4-irogers@google.com> Mime-Version: 1.0 References: <20210923074616.674826-1-irogers@google.com> X-Mailer: git-send-email 2.33.0.464.g1972c5931b-goog Subject: [PATCH v9 03/13] perf expr: Remove unused headers and inline d_ratio From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-kernel@vger.kernel.org, Andi Kleen , Jin Yao , John Garry , Paul Clarke , kajoljain , linux-perf-users@vger.kernel.org Cc: Stephane Eranian , Sandeep Dasgupta , Ian Rogers Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org No functional change. Inlining d_ratio makes it easier to special case for constants in a later patch. Signed-off-by: Ian Rogers --- tools/perf/util/expr.y | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/tools/perf/util/expr.y b/tools/perf/util/expr.y index 41c9cd4efadd..e6005450feae 100644 --- a/tools/perf/util/expr.y +++ b/tools/perf/util/expr.y @@ -2,23 +2,10 @@ %{ #define YYDEBUG 1 #include -#include -#include "util.h" #include "util/debug.h" -#include // strtod() +#include "smt.h" #define IN_EXPR_Y 1 #include "expr.h" -#include "smt.h" -#include - -static double d_ratio(double val0, double val1) -{ - if (val1 == 0) { - return 0; - } - return val0 / val1; -} - %} %define api.pure full @@ -120,7 +107,12 @@ expr: NUMBER | MIN '(' expr ',' expr ')' { $$ = $3 < $5 ? $3 : $5; } | MAX '(' expr ',' expr ')' { $$ = $3 > $5 ? $3 : $5; } | SMT_ON { $$ = smt_on() > 0; } - | D_RATIO '(' expr ',' expr ')' { $$ = d_ratio($3,$5); } + | D_RATIO '(' expr ',' expr ')' { if ($5 == 0) { + $$ = 0; + } else { + $$ = $3 / $5; + } + } ; %% -- 2.33.0.464.g1972c5931b-goog