Lines Matching +full:event +full:- +full:name

1 # SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
13 def ToPerfJson(self) -> str:
17 def ToPython(self) -> str:
25 def Equals(self, other) -> bool:
29 def Substitute(self, name: str, expression: 'Expression') -> 'Expression':
32 def __str__(self) -> str:
35 def __or__(self, other: Union[int, float, 'Expression']) -> 'Operator':
38 def __ror__(self, other: Union[int, float, 'Expression']) -> 'Operator':
41 def __xor__(self, other: Union[int, float, 'Expression']) -> 'Operator':
44 def __and__(self, other: Union[int, float, 'Expression']) -> 'Operator':
47 def __rand__(self, other: Union[int, float, 'Expression']) -> 'Operator':
50 def __lt__(self, other: Union[int, float, 'Expression']) -> 'Operator':
53 def __gt__(self, other: Union[int, float, 'Expression']) -> 'Operator':
56 def __add__(self, other: Union[int, float, 'Expression']) -> 'Operator':
59 def __radd__(self, other: Union[int, float, 'Expression']) -> 'Operator':
62 def __sub__(self, other: Union[int, float, 'Expression']) -> 'Operator':
63 return Operator('-', self, other)
65 def __rsub__(self, other: Union[int, float, 'Expression']) -> 'Operator':
66 return Operator('-', other, self)
68 def __mul__(self, other: Union[int, float, 'Expression']) -> 'Operator':
71 def __rmul__(self, other: Union[int, float, 'Expression']) -> 'Operator':
74 def __truediv__(self, other: Union[int, float, 'Expression']) -> 'Operator':
77 def __rtruediv__(self, other: Union[int, float, 'Expression']) -> 'Operator':
80 def __mod__(self, other: Union[int, float, 'Expression']) -> 'Operator':
84 def _Constify(val: Union[bool, int, float, Expression]) -> Expression:
105 '-': 4,
124 rhs: bool = False) -> str:
145 if _PRECEDENCE.get(self.operator, -1) > _PRECEDENCE.get(
146 other.operator, -1):
148 if rhs and _PRECEDENCE.get(self.operator, -1) == _PRECEDENCE.get(
149 other.operator, -1):
161 def Simplify(self) -> Expression:
171 # Simplify multiplication by 0 except for the slot event which
174 not isinstance(rhs, Event) or 'slots' not in rhs.name.lower()):
192 def Equals(self, other: Expression) -> bool:
198 def Substitute(self, name: str, expression: Expression) -> Expression:
200 return Event(name)
201 lhs = self.lhs.Substitute(name, expression)
204 rhs = self.rhs.Substitute(name, expression)
228 def Simplify(self) -> Expression:
240 def Equals(self, other: Expression) -> bool:
246 def Substitute(self, name: str, expression: Expression) -> Expression:
248 return Event(name)
249 true_val = self.true_val.Substitute(name, expression)
250 cond = self.cond.Substitute(name, expression)
251 false_val = self.false_val.Substitute(name, expression)
276 def Simplify(self) -> Expression:
288 def Equals(self, other: Expression) -> bool:
296 def Substitute(self, name: str, expression: Expression) -> Expression:
298 return Event(name)
299 lhs = self.lhs.Substitute(name, expression)
302 rhs = self.rhs.Substitute(name, expression)
306 def _FixEscapes(s: str) -> str:
311 class Event(Expression): class
312 """An event in an expression."""
314 def __init__(self, name: str, legacy_name: str = ''):
315 self.name = _FixEscapes(name)
319 result = re.sub('/', '@', self.name)
323 return f'Event(r"{self.name}")'
325 def Simplify(self) -> Expression:
328 def Equals(self, other: Expression) -> bool:
329 return isinstance(other, Event) and self.name == other.name
331 def Substitute(self, name: str, expression: Expression) -> Expression:
352 def Simplify(self) -> Expression:
355 def Equals(self, other: Expression) -> bool:
358 def Substitute(self, name: str, expression: Expression) -> Expression:
374 def Simplify(self) -> Expression:
377 def Equals(self, other: Expression) -> bool:
380 def Substitute(self, name: str, expression: Expression) -> Expression:
385 Expression]) -> Function:
386 # pylint: disable=redefined-builtin
387 # pylint: disable=invalid-name
392 Expression]) -> Function:
393 # pylint: disable=redefined-builtin
394 # pylint: disable=invalid-name
399 rhs: Union[int, float, Expression]) -> Function:
400 # pylint: disable=redefined-builtin
401 # pylint: disable=invalid-name
405 def source_count(event: Event) -> Function: argument
406 # pylint: disable=redefined-builtin
407 # pylint: disable=invalid-name
408 return Function('source_count', event)
411 def has_event(event: Event) -> Function: argument
412 # pylint: disable=redefined-builtin
413 # pylint: disable=invalid-name
414 return Function('has_event', event)
416 def strcmp_cpuid_str(cpuid: Event) -> Function: argument
417 # pylint: disable=redefined-builtin
418 # pylint: disable=invalid-name
429 name: str,
434 self.name = name
448 return self.name < other.name
452 self.groups.add(group.name)
454 def Flatten(self) -> Set['Metric']:
458 def ToPerfJson(self) -> Dict[str, str]:
461 'MetricName': self.name,
490 def __init__(self, name: str, metric_list: List[Union[Metric,
492 self.name = name
502 def Flatten(self) -> Set[Metric]:
510 def ToPerfJson(self) -> str:
513 def __str__(self) -> str:
518 """Transformer to convert if-else nodes to Select expressions."""
521 # pylint: disable=invalid-name
524 func=ast.Name(id='Select', ctx=ast.Load()),
531 def ParsePerfJson(orig: str) -> Expression:
535 eval routine. First tokens are mapped to Event calls, then
537 appropriate calls. Python's ast is used to match if-else that can't
546 # pylint: disable=eval-used
548 # First try to convert everything that looks like a string (event name) into Event(r"EVENT_NAME").
550 py = re.sub(r'([a-zA-Z][^-+/\* \\\(\),]*(?:\\.[^-+/\* \\\(\),]*)*)',
551 r'Event(r"\1")', py)
552 # If it started with a # it should have been a literal, rather than an event name
553 py = re.sub(r'#Event\(r"([^"]*)"\)', r'Literal("#\1")', py)
554 # Convert accidentally converted hex constants ("0Event(r"xDEADBEEF)"") back to a constant,
555 # but keep it wrapped in Event(), otherwise Python drops the 0x prefix and it gets interpreted as
557 py = re.sub(r'0Event\(r"[xX]([0-9a-fA-F]*)"\)', r'Event("0x\1")', py)
559 py = re.sub(r'([0-9]+)Event\(r"(e[0-9]+)"\)', r'\1\2', py)
563 py = re.sub(rf'Event\(r"{kw}"\)', kw, py)
574 )-> Dict[Tuple[str, str], Expression]:
580 Dict: mapping from a pmu, metric name pair to a shortened expression.