Lines Matching +full:event +full:- +full:name
2 # SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
30 def name(self) -> str: member in TreeValue
34 def description(self) -> str:
38 def matches(self, query: str) -> bool:
42 def parse(self) -> perf.evlist:
46 def value(self, evlist: perf.evlist, evsel: perf.evsel, cpu: int, thread: int) -> float:
55 def name(self) -> str: member in Metric
58 def description(self) -> str:
70 def matches(self, query: str) -> bool:
73 def parse(self) -> perf.evlist:
76 def value(self, evlist: perf.evlist, evsel: perf.evsel, cpu: int, thread: int) -> float:
83 """A PMU and event within the tree."""
85 event: str
87 def name(self) -> str: member in PmuEvent
88 if self.event.startswith(self.pmu) or ':' in self.event:
89 return self.event
91 return f"{self.pmu}/{self.event}/"
93 def description(self) -> str:
94 """Find and format event description for {pmu}/{event}/."""
96 if p.name() != self.pmu:
99 if "name" not in info or info["name"] != self.event:
110 def matches(self, query: str) -> bool:
111 return query in self.pmu or query in self.event
113 def parse(self) -> perf.evlist:
114 return perf.parse_events(self.name())
116 def value(self, evlist: perf.evlist, evsel: perf.evsel, cpu: int, thread: int) -> float:
133 def compose(self) -> ComposeResult:
136 def on_button_pressed(self, event: Button.Pressed) -> None:
146 margin-top: 1;
153 def compose(self) -> ComposeResult:
154 yield Horizontal(SearchIcon(), Input(placeholder="Event name"))
156 def on_input_submitted(self, event: Input.Submitted) -> None:
158 self.dismiss(event.value)
170 def __init__(self, cpu: int) -> None:
174 def compose(self) -> ComposeResult:
183 def __init__(self, cpu: int) -> None:
187 def compose(self) -> ComposeResult:
211 #sparkline_total > .sparkline--min-color {
214 #sparkline_total > .sparkline--max-color {
224 text-align: center;
228 def __init__(self, interval: float) -> None:
236 def expand_and_select(self, node: TreeNode[Any]) -> None:
246 def set_searched_tree_node(self, previous: bool) -> None:
261 idx = idx - 1 if idx > 0 else l - 1
263 idx = idx + 1 if idx < l - 1 else 0
265 idx = l - 1 if previous else 0
274 def action_search(self) -> None:
276 def set_initial_focus(event: str | None) -> None:
280 search_label.display = True if event else False
281 if not event:
283 event = event.lower()
284 search_label.update(f'Searching for events matching "{event}"')
288 def find_search_results(event: str, node: TreeNode[str],
291 ) -> Tuple[bool, Optional[TreeNode[str]]]:
295 if node.data and node.data.matches(event):
303 find_search_results(event, child, cursor_seen, match_after_cursor)
307 (_, self.cur_search_result) = find_search_results(event, tree.root)
309 self.push_screen(ErrorScreen(f"Failed to find pmu/event or metric {event}"))
318 def action_next(self) -> None:
322 def action_prev(self) -> None:
326 def action_collapse(self) -> None:
334 def update_counts(self) -> None:
352 # If there are more events than the width, remove the front event.
368 update_count(-1, total)
371 def on_mount(self) -> None:
372 """When App starts set up periodic event updating."""
376 def set_selected(self, value: TreeValue) -> None:
377 """Updates the event/description and starts the counters."""
389 # Remove previous event information.
400 # Update event/metric text and description.
401 label_name.update(value.name())
404 # Open the event.
414 self.push_screen(ErrorScreen(f"Failed to open {value.name()}"))
420 line = CounterSparkline(cpu=-1)
425 line = Counter(cpu=-1)
431 def compose(self) -> ComposeResult:
433 def metric_event_tree() -> Tree:
438 pmu_name = pmu.name().lower()
441 for event in sorted(pmu.events(), key=lambda x: x["name"]):
442 if "name" in event:
443 e = event["name"].lower()
444 if "alias" in event:
445 pmu_node.add_leaf(f'{e} ({event["alias"]})',
460 name = metric["MetricName"]
461 node.add_leaf(name, data=Metric(name))
462 child_group_name = f'{name}_group'
476 Vertical(Label("event name", id="event_name"),
484 def on_tree_node_selected(self, event: Tree.NodeSelected[TreeValue]) -> None:
485 """Called when a tree node is selected, selecting the event."""
486 if event.node.data:
487 self.set_selected(event.node.data)
492 ap.add_argument('-I', '--interval', help="Counter update interval in seconds", default=0.1)