Lines Matching refs:self

13   def ToPerfJson(self) -> str:  argument
17 def ToPython(self) -> str: argument
21 def Simplify(self): argument
25 def Equals(self, other) -> bool: argument
29 def Substitute(self, name: str, expression: 'Expression') -> 'Expression': argument
32 def __str__(self) -> str: argument
33 return self.ToPerfJson()
35 def __or__(self, other: Union[int, float, 'Expression']) -> 'Operator': argument
36 return Operator('|', self, other)
38 def __ror__(self, other: Union[int, float, 'Expression']) -> 'Operator': argument
39 return Operator('|', other, self)
41 def __xor__(self, other: Union[int, float, 'Expression']) -> 'Operator': argument
42 return Operator('^', self, other)
44 def __and__(self, other: Union[int, float, 'Expression']) -> 'Operator': argument
45 return Operator('&', self, other)
47 def __lt__(self, other: Union[int, float, 'Expression']) -> 'Operator': argument
48 return Operator('<', self, other)
50 def __gt__(self, other: Union[int, float, 'Expression']) -> 'Operator': argument
51 return Operator('>', self, other)
53 def __add__(self, other: Union[int, float, 'Expression']) -> 'Operator': argument
54 return Operator('+', self, other)
56 def __radd__(self, other: Union[int, float, 'Expression']) -> 'Operator': argument
57 return Operator('+', other, self)
59 def __sub__(self, other: Union[int, float, 'Expression']) -> 'Operator': argument
60 return Operator('-', self, other)
62 def __rsub__(self, other: Union[int, float, 'Expression']) -> 'Operator': argument
63 return Operator('-', other, self)
65 def __mul__(self, other: Union[int, float, 'Expression']) -> 'Operator': argument
66 return Operator('*', self, other)
68 def __rmul__(self, other: Union[int, float, 'Expression']) -> 'Operator': argument
69 return Operator('*', other, self)
71 def __truediv__(self, other: Union[int, float, 'Expression']) -> 'Operator': argument
72 return Operator('/', self, other)
74 def __rtruediv__(self, other: Union[int, float, 'Expression']) -> 'Operator': argument
75 return Operator('/', other, self)
77 def __mod__(self, other: Union[int, float, 'Expression']) -> 'Operator': argument
78 return Operator('%', self, other)
109 def __init__(self, operator: str, lhs: Union[int, float, Expression], argument
111 self.operator = operator
112 self.lhs = _Constify(lhs)
113 self.rhs = _Constify(rhs)
115 def Bracket(self, argument
139 if _PRECEDENCE.get(self.operator, -1) > _PRECEDENCE.get(
142 if rhs and _PRECEDENCE.get(self.operator, -1) == _PRECEDENCE.get(
147 def ToPerfJson(self): argument
151 def ToPython(self): argument
155 def Simplify(self) -> Expression: argument
156 lhs = self.lhs.Simplify()
157 rhs = self.rhs.Simplify()
159 return Constant(ast.literal_eval(lhs + self.operator + rhs))
161 if isinstance(self.lhs, Constant):
162 if self.operator in ('+', '|') and lhs.value == '0':
167 if self.operator == '*' and lhs.value == '0' and (
171 if self.operator == '*' and lhs.value == '1':
175 if self.operator in ('+', '|') and rhs.value == '0':
178 if self.operator == '*' and rhs.value == '0':
181 if self.operator == '*' and self.rhs.value == '1':
184 return Operator(self.operator, lhs, rhs)
186 def Equals(self, other: Expression) -> bool: argument
188 return self.operator == other.operator and self.lhs.Equals(
189 other.lhs) and self.rhs.Equals(other.rhs)
192 def Substitute(self, name: str, expression: Expression) -> Expression: argument
193 if self.Equals(expression):
195 lhs = self.lhs.Substitute(name, expression)
197 if self.rhs:
198 rhs = self.rhs.Substitute(name, expression)
199 return Operator(self.operator, lhs, rhs)
205 def __init__(self, true_val: Union[int, float, Expression], argument
208 self.true_val = _Constify(true_val)
209 self.cond = _Constify(cond)
210 self.false_val = _Constify(false_val)
212 def ToPerfJson(self): argument
213 true_str = self.true_val.ToPerfJson()
214 cond_str = self.cond.ToPerfJson()
215 false_str = self.false_val.ToPerfJson()
218 def ToPython(self): argument
222 def Simplify(self) -> Expression: argument
223 cond = self.cond.Simplify()
224 true_val = self.true_val.Simplify()
225 false_val = self.false_val.Simplify()
234 def Equals(self, other: Expression) -> bool: argument
236 return self.cond.Equals(other.cond) and self.false_val.Equals(
237 other.false_val) and self.true_val.Equals(other.true_val)
240 def Substitute(self, name: str, expression: Expression) -> Expression: argument
241 if self.Equals(expression):
243 true_val = self.true_val.Substitute(name, expression)
244 cond = self.cond.Substitute(name, expression)
245 false_val = self.false_val.Substitute(name, expression)
252 def __init__(self, argument
256 self.fn = fn
257 self.lhs = _Constify(lhs)
258 self.rhs = _Constify(rhs)
260 def ToPerfJson(self): argument
261 if self.rhs:
265 def ToPython(self): argument
266 if self.rhs:
270 def Simplify(self) -> Expression: argument
271 lhs = self.lhs.Simplify()
272 rhs = self.rhs.Simplify() if self.rhs else None
274 if self.fn == 'd_ratio':
280 return Function(self.fn, lhs, rhs)
282 def Equals(self, other: Expression) -> bool: argument
284 result = self.fn == other.fn and self.lhs.Equals(other.lhs)
285 if self.rhs:
286 result = result and self.rhs.Equals(other.rhs)
290 def Substitute(self, name: str, expression: Expression) -> Expression: argument
291 if self.Equals(expression):
293 lhs = self.lhs.Substitute(name, expression)
295 if self.rhs:
296 rhs = self.rhs.Substitute(name, expression)
297 return Function(self.fn, lhs, rhs)
308 def __init__(self, name: str, legacy_name: str = ''): argument
309 self.name = _FixEscapes(name)
310 self.legacy_name = _FixEscapes(legacy_name)
312 def ToPerfJson(self): argument
313 result = re.sub('/', '@', self.name)
316 def ToPython(self): argument
319 def Simplify(self) -> Expression: argument
320 return self
322 def Equals(self, other: Expression) -> bool: argument
323 return isinstance(other, Event) and self.name == other.name
325 def Substitute(self, name: str, expression: Expression) -> Expression: argument
326 return self
332 def __init__(self, value: Union[float, str]): argument
336 self.value = dec.normalize().to_eng_string()
337 self.value = self.value.replace('+', '')
338 self.value = self.value.replace('E', 'e')
340 def ToPerfJson(self): argument
341 return self.value
343 def ToPython(self): argument
346 def Simplify(self) -> Expression: argument
347 return self
349 def Equals(self, other: Expression) -> bool: argument
350 return isinstance(other, Constant) and self.value == other.value
352 def Substitute(self, name: str, expression: Expression) -> Expression: argument
353 return self
359 def __init__(self, value: str): argument
360 self.value = value
362 def ToPerfJson(self): argument
363 return self.value
365 def ToPython(self): argument
368 def Simplify(self) -> Expression: argument
369 return self
371 def Equals(self, other: Expression) -> bool: argument
372 return isinstance(other, Literal) and self.value == other.value
374 def Substitute(self, name: str, expression: Expression) -> Expression: argument
375 return self
412 def __init__(self, argument
418 self.name = name
419 self.description = description
420 self.expr = expr.Simplify()
424 self.scale_unit = scale_unit
426 self.scale_unit = f'1{scale_unit}'
427 self.constraint = constraint
428 self.groups = set()
430 def __lt__(self, other): argument
432 return self.name < other.name
434 def AddToMetricGroup(self, group): argument
436 self.groups.add(group.name)
438 def Flatten(self) -> Set['Metric']: argument
440 return set([self])
442 def ToPerfJson(self) -> Dict[str, str]: argument
445 'MetricName': self.name,
446 'MetricGroup': ';'.join(sorted(self.groups)),
447 'BriefDescription': self.description,
448 'MetricExpr': self.expr.ToPerfJson(),
449 'ScaleUnit': self.scale_unit
451 if self.constraint:
460 def default(self, o): argument
463 return json.JSONEncoder.default(self, o)
474 def __init__(self, name: str, metric_list: List[Union[Metric, argument
476 self.name = name
477 self.metric_list = metric_list
479 metric.AddToMetricGroup(self)
481 def AddToMetricGroup(self, group): argument
483 for metric in self.metric_list:
486 def Flatten(self) -> Set[Metric]: argument
489 for x in self.metric_list:
494 def ToPerfJson(self) -> str: argument
495 return json.dumps(sorted(self.Flatten()), indent=2, cls=_MetricJsonEncoder)
497 def __str__(self) -> str: argument
498 return self.ToPerfJson()
504 def visit_IfExp(self, node): argument
506 self.generic_visit(node)