Lines Matching +full:node +full:- +full:id
2 # SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
30 def name(self) -> str:
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:
56 def name(self) -> str:
59 def description(self) -> str:
73 def matches(self, query: str) -> bool:
76 def parse(self) -> perf.evlist:
79 def value(self, evlist: perf.evlist, evsel: perf.evsel, cpu: int, thread: int) -> float:
94 def name(self) -> str:
100 def description(self) -> str:
117 def matches(self, query: str) -> bool:
120 def parse(self) -> perf.evlist:
123 def value(self, evlist: perf.evlist, evsel: perf.evsel, cpu: int, thread: int) -> float:
140 def compose(self) -> ComposeResult:
141 yield Button(f"Error: {self.error}", variant="primary", id="error")
143 def on_button_pressed(self, event: Button.Pressed) -> None:
153 margin-top: 1;
160 def compose(self) -> ComposeResult:
163 def on_input_submitted(self, event: Input.Submitted) -> None:
177 def __init__(self, cpu: int) -> None:
181 def compose(self) -> ComposeResult:
184 yield Label("0", id=f"counter_{label}")
190 def __init__(self, cpu: int) -> None:
194 def compose(self) -> ComposeResult:
197 yield Sparkline([], summary_function=max, id=f"sparkline_{label}")
218 #sparkline_total > .sparkline--min-color {
221 #sparkline_total > .sparkline--max-color {
231 text-align: center;
235 def __init__(self, interval: float) -> None:
243 def expand_and_select(self, node: TreeNode[Any]) -> None:
244 """Expand select a node in the tree."""
245 if node.parent:
246 node.parent.expand()
247 if node.parent.parent:
248 node.parent.parent.expand()
249 node.expand()
250 node.tree.select_node(node)
251 node.tree.scroll_to_node(node)
253 def set_searched_tree_node(self, previous: bool) -> None:
254 """Set the cur_search_result node to either the next or previous."""
268 idx = idx - 1 if idx > 0 else l - 1
270 idx = idx + 1 if idx < l - 1 else 0
272 idx = l - 1 if previous else 0
274 node = self.search_results[idx]
275 if node == self.cur_search_result:
278 self.cur_search_result = node
279 self.expand_and_select(node)
281 def action_search(self) -> None:
283 def set_initial_focus(event: str | None) -> None:
295 def find_search_results(event: str, node: TreeNode[str],
298 ) -> Tuple[bool, Optional[TreeNode[str]]]:
300 if not cursor_seen and node == tree.cursor_node:
302 if node.data and node.data.matches(event):
304 match_after_cursor = node
305 self.search_results.append(node)
307 if node.children:
308 for child in node.children:
325 def action_next(self) -> None:
329 def action_prev(self) -> None:
333 def action_collapse(self) -> None:
336 node = tree.cursor_node
337 if node and node.parent:
338 node.parent.collapse_all()
339 node.tree.scroll_to_node(node.parent)
341 def update_counts(self) -> None:
375 update_count(-1, total)
378 def on_mount(self) -> None:
383 def set_selected(self, value: TreeValue) -> None:
427 line = CounterSparkline(cpu=-1)
432 line = Counter(cpu=-1)
438 def compose(self) -> ComposeResult:
440 def metric_event_tree() -> Tree:
442 tree: Tree[TreeValue] = Tree("Root", id="root")
466 def add_metrics_to_tree(node: TreeNode[TreeValue], parent: str, pmu: str = None):
476 node.add_leaf(display_name, data=Metric(name, metric_pmu))
482 add_metrics_to_tree(node.add(display_child_group_name),
494 yield Header(id="header")
495 yield Horizontal(Vertical(metric_event_tree(), id="events"),
496 Vertical(Label("event name", id="event_name"),
497 Static("description", markup=False, id="event_description"),
499 yield Label(id="active_search")
500 yield VerticalScroll(id="lines")
501 yield Footer(id="footer")
504 def on_tree_node_selected(self, event: Tree.NodeSelected[TreeValue]) -> None:
505 """Called when a tree node is selected, selecting the event."""
506 if event.node.data:
507 self.set_selected(event.node.data)
512 ap.add_argument('-I', '--interval', help="Counter update interval in seconds", default=0.1)