Lines Matching defs:metric

8 import metric
20 # List of regular metric tables.
22 # List of metric tables generated from "/sys" directories.
24 # Mapping between sys event table names and sys metric table names.
40 # Map from the name of a metric group to a description of the group.
126 def add(self, s: str, metric: bool) -> None:
132 if metric:
329 self.metric_expr = metric.ParsePerfJson(jd['MetricExpr']).Simplify()
330 # Note, the metric formula for the threshold isn't parsed as the &
380 def build_c_string(self, metric: bool) -> str:
382 for attr in _json_metric_attributes if metric else _json_event_attributes:
384 if metric and x and attr == 'metric_expr':
385 # Convert parsed metric expressions into a string. Slashes
388 if metric and x and attr == 'metric_threshold':
396 def to_c_string(self, metric: bool) -> str:
399 s = self.build_c_string(metric)
411 metrics: list[Tuple[str, str, metric.Expression]] = []
416 updates = metric.RewriteMetricsInTermsOfOthers(metrics)
485 _args.output_file.write(event.to_c_string(metric=False))
529 for metric in sorted(_pending_metrics, key=metric_cmp_key):
530 if metric.pmu != last_pmu:
533 pmu_name = metric.pmu.replace(',', '_')
537 last_pmu = metric.pmu
538 pmus.add((metric.pmu, pmu_name))
540 _args.output_file.write(metric.to_c_string(metric=True))
584 _bcs.add(mgroup, metric=True)
585 _bcs.add(description, metric=True)
593 _bcs.add(pmu_name, metric=False)
594 _bcs.add(event.build_c_string(metric=False), metric=False)
596 _bcs.add(pmu_name, metric=True)
597 _bcs.add(event.build_c_string(metric=True), metric=True)
643 /* Struct used to make the PMU metric table implementation opaque to callers. */