summaryrefslogtreecommitdiff
path: root/tools/perf/pmu-events/metric.py
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2023-08-30 16:06:38 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2023-08-30 16:06:38 -0700
commit1ac731c529cd4d6adbce134754b51ff7d822b145 (patch)
tree143ab3f35ca5f3b69f583c84e6964b17139c2ec1 /tools/perf/pmu-events/metric.py
parent07b4c950f27bef0362dc6ad7ee713aab61d58149 (diff)
parent54116d442e001e1b6bd482122043b1870998a1f3 (diff)
Merge branch 'next' into for-linus
Prepare input updates for 6.6 merge window.
Diffstat (limited to 'tools/perf/pmu-events/metric.py')
-rw-r--r--tools/perf/pmu-events/metric.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/perf/pmu-events/metric.py b/tools/perf/pmu-events/metric.py
index 77ea6ff985383..8ec0ba8846735 100644
--- a/tools/perf/pmu-events/metric.py
+++ b/tools/perf/pmu-events/metric.py
@@ -44,6 +44,9 @@ class Expression:
def __and__(self, other: Union[int, float, 'Expression']) -> 'Operator':
return Operator('&', self, other)
+ def __rand__(self, other: Union[int, float, 'Expression']) -> 'Operator':
+ return Operator('&', other, self)
+
def __lt__(self, other: Union[int, float, 'Expression']) -> 'Operator':
return Operator('<', self, other)
@@ -88,7 +91,10 @@ def _Constify(val: Union[bool, int, float, Expression]) -> Expression:
# Simple lookup for operator precedence, used to avoid unnecessary
-# brackets. Precedence matches that of python and the simple expression parser.
+# brackets. Precedence matches that of the simple expression parser
+# but differs from python where comparisons are lower precedence than
+# the bitwise &, ^, | but not the logical versions that the expression
+# parser doesn't have.
_PRECEDENCE = {
'|': 0,
'^': 1,