summaryrefslogtreecommitdiff
path: root/tools/perf/python
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/python')
-rw-r--r--tools/perf/python/perf.pyi7
-rwxr-xr-xtools/perf/python/treport.py2
2 files changed, 5 insertions, 4 deletions
diff --git a/tools/perf/python/perf.pyi b/tools/perf/python/perf.pyi
index c390e17708b1..92aad84ca542 100644
--- a/tools/perf/python/perf.pyi
+++ b/tools/perf/python/perf.pyi
@@ -332,13 +332,14 @@ class branch_stack:
class callchain_node:
"""Represents a frame in the callchain."""
ip: int
- symbol: Optional[str]
- dso: Optional[str]
+ symbol: str
+ dso: str
class callchain:
"""Sequence of callchain frames."""
def __len__(self) -> int: ...
def __getitem__(self, index: int) -> callchain_node: ...
+ def __iter__(self) -> Iterator[callchain_node]: ...
class stat_event(_sample_members):
"""Represents a stat event from perf."""
@@ -453,7 +454,7 @@ class session:
def process_events(self) -> None:
"""Process all events in the session."""
...
- def find_thread(self, pid: int) -> thread:
+ def find_thread(self, pid: int, tid: int = -1, /) -> Optional[thread]:
"""Returns the thread associated with a pid."""
...
diff --git a/tools/perf/python/treport.py b/tools/perf/python/treport.py
index 43542599a884..786b852f471c 100755
--- a/tools/perf/python/treport.py
+++ b/tools/perf/python/treport.py
@@ -92,7 +92,7 @@ class ProfileNode:
try:
assert session
thread = session.find_thread(sample.sample_tid)
- comm = thread.comm()
+ comm = (thread.comm() if thread else None) or f"unknown ({pid})"
except Exception:
comm = f"unknown ({pid})"