diff options
author | Ian Rogers <[email protected]> | 2021-09-23 00:46:06 -0700 |
---|---|---|
committer | Arnaldo Carvalho de Melo <[email protected]> | 2021-09-29 13:26:27 -0300 |
commit | 7f8fdcbbbefb2d95259aa76a362689affafa4e4b (patch) | |
tree | 317c9818cac5a6b3fca9c37d5e1a77d4136469f3 | |
parent | edfe7f554ab8f083556c718ecbcefda509c46851 (diff) |
perf expr: Remove unused headers and inline d_ratio
No functional change. Inlining d_ratio makes it easier to special case
for constants in a later patch.
Signed-off-by: Ian Rogers <[email protected]>
Tested-by: John Garry <[email protected]>
Acked-by: Jiri Olsa <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Kajol Jain <[email protected]>
Cc: Jin Yao <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Paul Clarke <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Sandeep Dasgupta <[email protected]>
Cc: Stephane Eranian <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
-rw-r--r-- | tools/perf/util/expr.y | 22 |
1 files 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 <math.h> -#include <stdio.h> -#include "util.h" #include "util/debug.h" -#include <stdlib.h> // strtod() +#include "smt.h" #define IN_EXPR_Y 1 #include "expr.h" -#include "smt.h" -#include <string.h> - -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; + } + } ; %% |