From f3ed4247619363b05313644325874333926414bd Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Thu, 7 Mar 2024 16:30:39 +0000 Subject: [PATCH] Print the thread name in the live TUI To allow users to determine thread in a multithreaded application corresponds to the "Thread X of Y" number displayed in the live view, include the thread name that we collect in the TUI. Signed-off-by: Pablo Galindo --- news/562.feature.rst | 1 + src/memray/reporters/tui.py | 12 +- .../unit/__snapshots__/test_tui_reporter.ambr | 1082 ++++++++--------- tests/unit/test_tui_reporter.py | 6 +- 4 files changed, 553 insertions(+), 548 deletions(-) create mode 100644 news/562.feature.rst diff --git a/news/562.feature.rst b/news/562.feature.rst new file mode 100644 index 0000000000..d008984f64 --- /dev/null +++ b/news/562.feature.rst @@ -0,0 +1 @@ +Include the thread name in the live TUI diff --git a/src/memray/reporters/tui.py b/src/memray/reporters/tui.py index 4ae8b6cfa4..6cae89bc0d 100644 --- a/src/memray/reporters/tui.py +++ b/src/memray/reporters/tui.py @@ -540,7 +540,7 @@ def __init__(self, pid: Optional[int], cmd_line: Optional[str], native: bool): self.pid = pid self.cmd_line = cmd_line self.native = native - self._seen_threads: Set[int] = set() + self._seen_threads: Dict[int, str] = {} self._max_memory_seen = 0 super().__init__() @@ -578,7 +578,7 @@ def watch_thread_idx(self, thread_idx: int) -> None: """Called when the thread_idx attribute changes.""" self.query_one("#tid", Label).update(f"[b]TID[/]: {hex(self.current_thread)}") self.query_one("#thread", Label).update( - f"[b]Thread[/] {thread_idx + 1} of {len(self.threads)}" + f"[b]Thread[/] {thread_idx + 1} of {len(self.threads)} ({self.threads[thread_idx]})" ) self.query_one(AllocationTable).current_thread = self.current_thread @@ -586,7 +586,7 @@ def watch_threads(self, threads: List[int]) -> None: """Called when the threads attribute changes.""" self.query_one("#tid", Label).update(f"[b]TID[/]: {hex(self.current_thread)}") self.query_one("#thread", Label).update( - f"[b]Thread[/] {self.thread_idx + 1} of {len(threads)}" + f"[b]Thread[/] {self.thread_idx + 1} of {len(self.threads)} ({self.threads[self.thread_idx]})" ) def watch_disconnected(self) -> None: @@ -644,7 +644,11 @@ def display_snapshot(self) -> None: if self.paused: return - new_tids = {record.tid for record in snapshot.records} - self._seen_threads + new_tids = { + record.tid: record.thread_name + for record in snapshot.records + if record.tid not in self._seen_threads + } self._seen_threads.update(new_tids) if new_tids: diff --git a/tests/unit/__snapshots__/test_tui_reporter.ambr b/tests/unit/__snapshots__/test_tui_reporter.ambr index aae1c29b29..2f8a89046c 100644 --- a/tests/unit/__snapshots__/test_tui_reporter.ambr +++ b/tests/unit/__snapshots__/test_tui_reporter.ambr @@ -22,144 +22,144 @@ font-weight: 700; } - .terminal-330546721-matrix { + .terminal-1659092547-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-330546721-title { + .terminal-1659092547-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-330546721-r1 { fill: #e1e1e1;font-weight: bold } - .terminal-330546721-r2 { fill: #e1e1e1 } - .terminal-330546721-r3 { fill: #c5c8c6 } - .terminal-330546721-r4 { fill: #be3f48 } - .terminal-330546721-r5 { fill: #64d484 } - .terminal-330546721-r6 { fill: #dde6ed;font-weight: bold } - .terminal-330546721-r7 { fill: #dde6ed;font-weight: bold;text-decoration: underline; } - .terminal-330546721-r8 { fill: #e1e2e3 } - .terminal-330546721-r9 { fill: #cd5c5c } - .terminal-330546721-r10 { fill: #61c12c } - .terminal-330546721-r11 { fill: #fb8e03 } - .terminal-330546721-r12 { fill: #ee960d } - .terminal-330546721-r13 { fill: #8eb322 } - .terminal-330546721-r14 { fill: #e1f0ff;font-weight: bold } + .terminal-1659092547-r1 { fill: #e1e1e1;font-weight: bold } + .terminal-1659092547-r2 { fill: #e1e1e1 } + .terminal-1659092547-r3 { fill: #c5c8c6 } + .terminal-1659092547-r4 { fill: #be3f48 } + .terminal-1659092547-r5 { fill: #64d484 } + .terminal-1659092547-r6 { fill: #dde6ed;font-weight: bold } + .terminal-1659092547-r7 { fill: #dde6ed;font-weight: bold;text-decoration: underline; } + .terminal-1659092547-r8 { fill: #e1e2e3 } + .terminal-1659092547-r9 { fill: #cd5c5c } + .terminal-1659092547-r10 { fill: #61c12c } + .terminal-1659092547-r11 { fill: #fb8e03 } + .terminal-1659092547-r12 { fill: #ee960d } + .terminal-1659092547-r13 { fill: #8eb322 } + .terminal-1659092547-r14 { fill: #e1f0ff;font-weight: bold } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - MockApp + MockApp - - - - Memray live tracking      Fri Oct 13 12:00:00 2023 - PID: ???CMD: ??? - TID: 0x1Thread 1 of 1 - Samples: 2Duration: 42.0 seconds - StatusRemote has disconnected - -  Heap Usage ───────────────────────────────────── -                                                  ▐ -                                                  ▐ -                                                  █ -                                                  █ - ────────────────── 2.325KB (100% of 2.325KB max)  -                       Location                      Total Bytes% TotalO -  parent                                                 2.325KB100.00% -  grandparent                                            2.325KB100.00% -  f2                                                     1.325KB 56.99% -  f1                                                     1.000KB 43.01% -  malloc                                                333.000B 13.99% -  something0                                            333.000B 13.99% -  something1                                            333.000B 13.99% -  something2                                            333.000B 13.99% -  something3                                            333.000B 13.99% -  something4                                            333.000B 13.99% -  Q  Quit  <  Previous Thread  >  Next Thread  T  Sort by Total  O  Sort by Ow… + + + + Memray live tracking      Fri Oct 13 12:00:00 2023 + PID: ???CMD: ??? + TID: 0x1Thread 1 of 1 (1) + Samples: 2Duration: 42.0 seconds + StatusRemote has disconnected + +  Heap Usage ───────────────────────────────────── +                                                  ▐ +                                                  ▐ +                                                  █ +                                                  █ + ────────────────── 2.325KB (100% of 2.325KB max)  +                       Location                      Total Bytes% TotalO +  parent                                                 2.325KB100.00% +  grandparent                                            2.325KB100.00% +  f2                                                     1.325KB 56.99% +  f1                                                     1.000KB 43.01% +  malloc                                                333.000B 13.99% +  something0                                            333.000B 13.99% +  something1                                            333.000B 13.99% +  something2                                            333.000B 13.99% +  something3                                            333.000B 13.99% +  something4                                            333.000B 13.99% +  Q  Quit  <  Previous Thread  >  Next Thread  T  Sort by Total  O  Sort by Ow… @@ -353,148 +353,148 @@ font-weight: 700; } - .terminal-4045969315-matrix { + .terminal-1330288581-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-4045969315-title { + .terminal-1330288581-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-4045969315-r1 { fill: #e1e1e1;font-weight: bold } - .terminal-4045969315-r2 { fill: #e1e1e1 } - .terminal-4045969315-r3 { fill: #c5c8c6 } - .terminal-4045969315-r4 { fill: #00ff00 } - .terminal-4045969315-r5 { fill: #64d484 } - .terminal-4045969315-r6 { fill: #be3f48 } - .terminal-4045969315-r7 { fill: #dde6ed;font-weight: bold } - .terminal-4045969315-r8 { fill: #dde6ed;font-weight: bold;text-decoration: underline; } - .terminal-4045969315-r9 { fill: #dde6ed } - .terminal-4045969315-r10 { fill: #e1e2e3 } - .terminal-4045969315-r11 { fill: #cd5c5c } - .terminal-4045969315-r12 { fill: #61c12c } - .terminal-4045969315-r13 { fill: #c9a217 } - .terminal-4045969315-r14 { fill: #f7840d } - .terminal-4045969315-r15 { fill: #a6ac1e } - .terminal-4045969315-r16 { fill: #d39f14 } - .terminal-4045969315-r17 { fill: #83b625 } - .terminal-4045969315-r18 { fill: #e1f0ff;font-weight: bold } + .terminal-1330288581-r1 { fill: #e1e1e1;font-weight: bold } + .terminal-1330288581-r2 { fill: #e1e1e1 } + .terminal-1330288581-r3 { fill: #c5c8c6 } + .terminal-1330288581-r4 { fill: #00ff00 } + .terminal-1330288581-r5 { fill: #64d484 } + .terminal-1330288581-r6 { fill: #be3f48 } + .terminal-1330288581-r7 { fill: #dde6ed;font-weight: bold } + .terminal-1330288581-r8 { fill: #dde6ed;font-weight: bold;text-decoration: underline; } + .terminal-1330288581-r9 { fill: #dde6ed } + .terminal-1330288581-r10 { fill: #e1e2e3 } + .terminal-1330288581-r11 { fill: #cd5c5c } + .terminal-1330288581-r12 { fill: #61c12c } + .terminal-1330288581-r13 { fill: #c9a217 } + .terminal-1330288581-r14 { fill: #f7840d } + .terminal-1330288581-r15 { fill: #a6ac1e } + .terminal-1330288581-r16 { fill: #d39f14 } + .terminal-1330288581-r17 { fill: #83b625 } + .terminal-1330288581-r18 { fill: #e1f0ff;font-weight: bold } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - MockApp + MockApp - - - - Memray live tracking      Fri Oct 13 12:00:00 2023 -  (∩`-´)⊃━☆゚.*・。゚  Heap Usage ───────────────────────────────────── - PID: ???CMD: ???                                                 ▐ - TID: 0x1Thread 1 of 1                                                 ▐ - Samples: 2Duration: 42.0 seconds                                                 ▟ - StatusRemote has disconnected                                                 █ - ────────────────── 3.000KB (100% of 3.000KB max)  - -                       Location                      Total Bytes% TotalOwn Bytes% OwnAllocations File/Module  -  parent                                                 3.000KB100.00%   0.000B 0.00%          3 fun.py       -  grandparent                                            3.000KB100.00%   0.000B 0.00%          3 fun.py       -  f2                                                     2.000KB 66.67%   0.000B 0.00%          2 f.py         -  malloc                                                 1.000KB 33.33%  1.000KB33.33%          1 malloc.c     -  f1                                                     1.000KB 33.33%   0.000B 0.00%          1 f.py         - - - - - - - - - -  Q  Quit  <  Previous Thread  >  Next Thread  T  Sort by Total  O  Sort by Own  A  Sort by Allocations  + + + + Memray live tracking      Fri Oct 13 12:00:00 2023 +  (∩`-´)⊃━☆゚.*・。゚  Heap Usage ───────────────────────────────────── + PID: ???CMD: ???                                                 ▐ + TID: 0x1Thread 1 of 1 (1)                                                 ▐ + Samples: 2Duration: 42.0 seconds                                                 ▟ + StatusRemote has disconnected                                                 █ + ────────────────── 3.000KB (100% of 3.000KB max)  + +                       Location                      Total Bytes% TotalOwn Bytes% OwnAllocations File/Module  +  parent                                                 3.000KB100.00%   0.000B 0.00%          3 fun.py       +  grandparent                                            3.000KB100.00%   0.000B 0.00%          3 fun.py       +  f2                                                     2.000KB 66.67%   0.000B 0.00%          2 f.py         +  malloc                                                 1.000KB 33.33%  1.000KB33.33%          1 malloc.c     +  f1                                                     1.000KB 33.33%   0.000B 0.00%          1 f.py         + + + + + + + + + +  Q  Quit  <  Previous Thread  >  Next Thread  T  Sort by Total  O  Sort by Own  A  Sort by Allocations  @@ -524,150 +524,150 @@ font-weight: 700; } - .terminal-3511924984-matrix { + .terminal-1545517338-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-3511924984-title { + .terminal-1545517338-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-3511924984-r1 { fill: #e1e1e1;font-weight: bold } - .terminal-3511924984-r2 { fill: #e1e1e1 } - .terminal-3511924984-r3 { fill: #c5c8c6 } - .terminal-3511924984-r4 { fill: #00ff00 } - .terminal-3511924984-r5 { fill: #64d484 } - .terminal-3511924984-r6 { fill: #be3f48 } - .terminal-3511924984-r7 { fill: #dde6ed;font-weight: bold } - .terminal-3511924984-r8 { fill: #dde6ed;font-weight: bold;text-decoration: underline; } - .terminal-3511924984-r9 { fill: #e1e2e3 } - .terminal-3511924984-r10 { fill: #cd5c5c } - .terminal-3511924984-r11 { fill: #61c12c } - .terminal-3511924984-r12 { fill: #83b625 } - .terminal-3511924984-r13 { fill: #fb8e03 } - .terminal-3511924984-r14 { fill: #75ba27 } - .terminal-3511924984-r15 { fill: #ee960d } - .terminal-3511924984-r16 { fill: #6bbd29 } - .terminal-3511924984-r17 { fill: #8eb322 } - .terminal-3511924984-r18 { fill: #14191f } - .terminal-3511924984-r19 { fill: #23568b } - .terminal-3511924984-r20 { fill: #e1f0ff;font-weight: bold } + .terminal-1545517338-r1 { fill: #e1e1e1;font-weight: bold } + .terminal-1545517338-r2 { fill: #e1e1e1 } + .terminal-1545517338-r3 { fill: #c5c8c6 } + .terminal-1545517338-r4 { fill: #00ff00 } + .terminal-1545517338-r5 { fill: #64d484 } + .terminal-1545517338-r6 { fill: #be3f48 } + .terminal-1545517338-r7 { fill: #dde6ed;font-weight: bold } + .terminal-1545517338-r8 { fill: #dde6ed;font-weight: bold;text-decoration: underline; } + .terminal-1545517338-r9 { fill: #e1e2e3 } + .terminal-1545517338-r10 { fill: #cd5c5c } + .terminal-1545517338-r11 { fill: #61c12c } + .terminal-1545517338-r12 { fill: #83b625 } + .terminal-1545517338-r13 { fill: #fb8e03 } + .terminal-1545517338-r14 { fill: #75ba27 } + .terminal-1545517338-r15 { fill: #ee960d } + .terminal-1545517338-r16 { fill: #6bbd29 } + .terminal-1545517338-r17 { fill: #8eb322 } + .terminal-1545517338-r18 { fill: #14191f } + .terminal-1545517338-r19 { fill: #23568b } + .terminal-1545517338-r20 { fill: #e1f0ff;font-weight: bold } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - MockApp + MockApp - - - - Memray live tracking      Fri Oct 13 12:00:00 2023 -  (∩`-´)⊃━☆゚.*・。゚  Heap Usage ───────────────────── - PID: ???CMD: ???                                 ▐ - TID: 0x1Thread 1 of 1                                 ▐ - Samples: 2Duration: 42.0 seconds                                 █ - StatusRemote has disconnected                                 █ - ── 2.325KB (100% of 2.325KB max)  - -                       Location                      Total Bytes% TotalOwn Bytes% OwnAllocations File/Module -  parent                                                 2.325KB100.00%   0.000B 0.00%          3 fun.py      -  grandparent                                            2.325KB100.00%   0.000B 0.00%          3 fun.py      -  f2                                                     1.325KB 56.99%   0.000B 0.00%          2 f.py        -  f1                                                     1.000KB 43.01%   0.000B 0.00%          1 f.py        -  malloc                                                333.000B 13.99% 333.000B13.99%          1 malloc.c    -  something0                                            333.000B 13.99%   0.000B 0.00%          1 something.p -  something1                                            333.000B 13.99%   0.000B 0.00%          1 something.p▃▃ -  something2                                            333.000B 13.99%   0.000B 0.00%          1 something.p -  something3                                            333.000B 13.99%   0.000B 0.00%          1 something.p -  something4                                            333.000B 13.99%   0.000B 0.00%          1 something.p -  something5                                            333.000B 13.99%   0.000B 0.00%          1 something.p -  something6                                            333.000B 13.99%   0.000B 0.00%          1 something.p -  something7                                            333.000B 13.99%   0.000B 0.00%          1 something.p - -  Q  Quit  <  Previous Thread  >  Next Thread  T  Sort by Total  O  Sort by Own  A  Sort by Allocations  + + + + Memray live tracking      Fri Oct 13 12:00:00 2023 +  (∩`-´)⊃━☆゚.*・。゚  Heap Usage ───────────────────── + PID: ???CMD: ???                                 ▐ + TID: 0x1Thread 1 of 1 (1)                                 ▐ + Samples: 2Duration: 42.0 seconds                                 █ + StatusRemote has disconnected                                 █ + ── 2.325KB (100% of 2.325KB max)  + +                       Location                      Total Bytes% TotalOwn Bytes% OwnAllocations File/Module +  parent                                                 2.325KB100.00%   0.000B 0.00%          3 fun.py      +  grandparent                                            2.325KB100.00%   0.000B 0.00%          3 fun.py      +  f2                                                     1.325KB 56.99%   0.000B 0.00%          2 f.py        +  f1                                                     1.000KB 43.01%   0.000B 0.00%          1 f.py        +  malloc                                                333.000B 13.99% 333.000B13.99%          1 malloc.c    +  something0                                            333.000B 13.99%   0.000B 0.00%          1 something.p +  something1                                            333.000B 13.99%   0.000B 0.00%          1 something.p▃▃ +  something2                                            333.000B 13.99%   0.000B 0.00%          1 something.p +  something3                                            333.000B 13.99%   0.000B 0.00%          1 something.p +  something4                                            333.000B 13.99%   0.000B 0.00%          1 something.p +  something5                                            333.000B 13.99%   0.000B 0.00%          1 something.p +  something6                                            333.000B 13.99%   0.000B 0.00%          1 something.p +  something7                                            333.000B 13.99%   0.000B 0.00%          1 something.p + +  Q  Quit  <  Previous Thread  >  Next Thread  T  Sort by Total  O  Sort by Own  A  Sort by Allocations  @@ -697,241 +697,241 @@ font-weight: 700; } - .terminal-3098411811-matrix { + .terminal-1757872965-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-3098411811-title { + .terminal-1757872965-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-3098411811-r1 { fill: #e1e1e1;font-weight: bold } - .terminal-3098411811-r2 { fill: #e1e1e1 } - .terminal-3098411811-r3 { fill: #c5c8c6 } - .terminal-3098411811-r4 { fill: #00ff00 } - .terminal-3098411811-r5 { fill: #64d484 } - .terminal-3098411811-r6 { fill: #be3f48 } - .terminal-3098411811-r7 { fill: #dde6ed;font-weight: bold } - .terminal-3098411811-r8 { fill: #dde6ed;font-weight: bold;text-decoration: underline; } - .terminal-3098411811-r9 { fill: #dde6ed } - .terminal-3098411811-r10 { fill: #e1e2e3 } - .terminal-3098411811-r11 { fill: #cd5c5c } - .terminal-3098411811-r12 { fill: #67be2a } - .terminal-3098411811-r13 { fill: #75ba27 } - .terminal-3098411811-r14 { fill: #d05f55 } - .terminal-3098411811-r15 { fill: #d4634e } - .terminal-3098411811-r16 { fill: #d86647 } - .terminal-3098411811-r17 { fill: #6bbd29 } - .terminal-3098411811-r18 { fill: #72bb28 } - .terminal-3098411811-r19 { fill: #dc6a40 } - .terminal-3098411811-r20 { fill: #df6e39 } - .terminal-3098411811-r21 { fill: #e37132 } - .terminal-3098411811-r22 { fill: #e87629 } - .terminal-3098411811-r23 { fill: #6ebc29 } - .terminal-3098411811-r24 { fill: #ec7a22 } - .terminal-3098411811-r25 { fill: #f07d1b } - .terminal-3098411811-r26 { fill: #f38114 } - .terminal-3098411811-r27 { fill: #f7840d } - .terminal-3098411811-r28 { fill: #fb8806 } - .terminal-3098411811-r29 { fill: #fe8c00 } - .terminal-3098411811-r30 { fill: #fb8e03 } - .terminal-3098411811-r31 { fill: #f89005 } - .terminal-3098411811-r32 { fill: #f49208 } - .terminal-3098411811-r33 { fill: #f1940b } - .terminal-3098411811-r34 { fill: #ee960d } - .terminal-3098411811-r35 { fill: #e89910 } - .terminal-3098411811-r36 { fill: #de9c12 } - .terminal-3098411811-r37 { fill: #d0a015 } - .terminal-3098411811-r38 { fill: #64bf2b } - .terminal-3098411811-r39 { fill: #c5a317 } - .terminal-3098411811-r40 { fill: #b7a71a } - .terminal-3098411811-r41 { fill: #adaa1c } - .terminal-3098411811-r42 { fill: #9fae1f } - .terminal-3098411811-r43 { fill: #91b222 } - .terminal-3098411811-r44 { fill: #61c12c } - .terminal-3098411811-r45 { fill: #87b524 } - .terminal-3098411811-r46 { fill: #79b927 } - .terminal-3098411811-r47 { fill: #e1f0ff;font-weight: bold } + .terminal-1757872965-r1 { fill: #e1e1e1;font-weight: bold } + .terminal-1757872965-r2 { fill: #e1e1e1 } + .terminal-1757872965-r3 { fill: #c5c8c6 } + .terminal-1757872965-r4 { fill: #00ff00 } + .terminal-1757872965-r5 { fill: #64d484 } + .terminal-1757872965-r6 { fill: #be3f48 } + .terminal-1757872965-r7 { fill: #dde6ed;font-weight: bold } + .terminal-1757872965-r8 { fill: #dde6ed;font-weight: bold;text-decoration: underline; } + .terminal-1757872965-r9 { fill: #dde6ed } + .terminal-1757872965-r10 { fill: #e1e2e3 } + .terminal-1757872965-r11 { fill: #cd5c5c } + .terminal-1757872965-r12 { fill: #67be2a } + .terminal-1757872965-r13 { fill: #75ba27 } + .terminal-1757872965-r14 { fill: #d05f55 } + .terminal-1757872965-r15 { fill: #d4634e } + .terminal-1757872965-r16 { fill: #d86647 } + .terminal-1757872965-r17 { fill: #6bbd29 } + .terminal-1757872965-r18 { fill: #72bb28 } + .terminal-1757872965-r19 { fill: #dc6a40 } + .terminal-1757872965-r20 { fill: #df6e39 } + .terminal-1757872965-r21 { fill: #e37132 } + .terminal-1757872965-r22 { fill: #e87629 } + .terminal-1757872965-r23 { fill: #6ebc29 } + .terminal-1757872965-r24 { fill: #ec7a22 } + .terminal-1757872965-r25 { fill: #f07d1b } + .terminal-1757872965-r26 { fill: #f38114 } + .terminal-1757872965-r27 { fill: #f7840d } + .terminal-1757872965-r28 { fill: #fb8806 } + .terminal-1757872965-r29 { fill: #fe8c00 } + .terminal-1757872965-r30 { fill: #fb8e03 } + .terminal-1757872965-r31 { fill: #f89005 } + .terminal-1757872965-r32 { fill: #f49208 } + .terminal-1757872965-r33 { fill: #f1940b } + .terminal-1757872965-r34 { fill: #ee960d } + .terminal-1757872965-r35 { fill: #e89910 } + .terminal-1757872965-r36 { fill: #de9c12 } + .terminal-1757872965-r37 { fill: #d0a015 } + .terminal-1757872965-r38 { fill: #64bf2b } + .terminal-1757872965-r39 { fill: #c5a317 } + .terminal-1757872965-r40 { fill: #b7a71a } + .terminal-1757872965-r41 { fill: #adaa1c } + .terminal-1757872965-r42 { fill: #9fae1f } + .terminal-1757872965-r43 { fill: #91b222 } + .terminal-1757872965-r44 { fill: #61c12c } + .terminal-1757872965-r45 { fill: #87b524 } + .terminal-1757872965-r46 { fill: #79b927 } + .terminal-1757872965-r47 { fill: #e1f0ff;font-weight: bold } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - MockApp + MockApp - - - - Memray live tracking      Fri Oct 13 12:00:00 2023 -  (∩`-´)⊃━☆゚.*・。゚  Heap Usage ────────────────────── - PID: ???CMD: ???                                  ▐ - TID: 0x1Thread 1 of 1                                  ▐ - Samples: 1Duration: 42.0 seconds                                  ▐ - StatusRemote has disconnected                                  ▐ -  34.248KB (100% of 34.248KB max)  - -                       Location                      Total Bytes% TotalOwn Bytes% OwnAllocations  File/Module    -  function0                                             34.248KB100.00%  1.000KB2.92%         30 /abc/lel_0.py   -  function1                                             33.248KB 97.08%  1.010KB2.95%         29 /abc/lel_1.py   -  function2                                             32.238KB 94.13%  1.020KB2.98%         28 /abc/lel_2.py   -  function3                                             31.219KB 91.15%  1.029KB3.01%         27 /abc/lel_3.py   -  function4                                             30.189KB 88.15%  1.039KB3.03%         26 /abc/lel_4.py   -  function5                                             29.150KB 85.12%  1.049KB3.06%         25 /abc/lel_5.py   -  function6                                             28.102KB 82.05%  1.059KB3.09%         24 /abc/lel_6.py   -  function7                                             27.043KB 78.96%  1.068KB3.12%         23 /abc/lel_7.py   -  function8                                             25.975KB 75.84%  1.078KB3.15%         22 /abc/lel_8.py   -  function9                                             24.896KB 72.69%  1.088KB3.18%         21 /abc/lel_9.py   -  function10                                            23.809KB 69.52%  1.098KB3.21%         20 /abc/lel_10.py  -  function11                                            22.711KB 66.31%  1.107KB3.23%         19 /abc/lel_11.py  -  function12                                            21.604KB 63.08%  1.117KB3.26%         18 /abc/lel_12.py  -  function13                                            20.486KB 59.82%  1.127KB3.29%         17 /abc/lel_13.py  -  function14                                            19.359KB 56.53%  1.137KB3.32%         16 /abc/lel_14.py  -  function15                                            18.223KB 53.21%  1.146KB3.35%         15 /abc/lel_15.py  -  function16                                            17.076KB 49.86%  1.156KB3.38%         14 /abc/lel_16.py  -  function17                                            15.920KB 46.48%  1.166KB3.40%         13 /abc/lel_17.py  -  function18                                            14.754KB 43.08%  1.176KB3.43%         12 /abc/lel_18.py  -  function19                                            13.578KB 39.65%  1.186KB3.46%         11 /abc/lel_19.py  -  function20                                            12.393KB 36.18%  1.195KB3.49%         10 /abc/lel_20.py  -  function21                                            11.197KB 32.69%  1.205KB3.52%          9 /abc/lel_21.py  -  function22                                             9.992KB 29.18%  1.215KB3.55%          8 /abc/lel_22.py  -  function23                                             8.777KB 25.63%  1.225KB3.58%          7 /abc/lel_23.py  -  function24                                             7.553KB 22.05%  1.234KB3.60%          6 /abc/lel_24.py  -  function25                                             6.318KB 18.45%  1.244KB3.63%          5 /abc/lel_25.py  -  function26                                             5.074KB 14.82%  1.254KB3.66%          4 /abc/lel_26.py  -  function27                                             3.820KB 11.15%  1.264KB3.69%          3 /abc/lel_27.py  -  function28                                             2.557KB  7.47%  1.273KB3.72%          2 /abc/lel_28.py  -  function29                                             1.283KB  3.75%  1.283KB3.75%          1 /abc/lel_29.py  -  Q  Quit  <  Previous Thread  >  Next Thread  T  Sort by Total  O  Sort by Own  A  Sort by Allocations  + + + + Memray live tracking      Fri Oct 13 12:00:00 2023 +  (∩`-´)⊃━☆゚.*・。゚  Heap Usage ────────────────────── + PID: ???CMD: ???                                  ▐ + TID: 0x1Thread 1 of 1 (1)                                  ▐ + Samples: 1Duration: 42.0 seconds                                  ▐ + StatusRemote has disconnected                                  ▐ +  34.248KB (100% of 34.248KB max)  + +                       Location                      Total Bytes% TotalOwn Bytes% OwnAllocations  File/Module    +  function0                                             34.248KB100.00%  1.000KB2.92%         30 /abc/lel_0.py   +  function1                                             33.248KB 97.08%  1.010KB2.95%         29 /abc/lel_1.py   +  function2                                             32.238KB 94.13%  1.020KB2.98%         28 /abc/lel_2.py   +  function3                                             31.219KB 91.15%  1.029KB3.01%         27 /abc/lel_3.py   +  function4                                             30.189KB 88.15%  1.039KB3.03%         26 /abc/lel_4.py   +  function5                                             29.150KB 85.12%  1.049KB3.06%         25 /abc/lel_5.py   +  function6                                             28.102KB 82.05%  1.059KB3.09%         24 /abc/lel_6.py   +  function7                                             27.043KB 78.96%  1.068KB3.12%         23 /abc/lel_7.py   +  function8                                             25.975KB 75.84%  1.078KB3.15%         22 /abc/lel_8.py   +  function9                                             24.896KB 72.69%  1.088KB3.18%         21 /abc/lel_9.py   +  function10                                            23.809KB 69.52%  1.098KB3.21%         20 /abc/lel_10.py  +  function11                                            22.711KB 66.31%  1.107KB3.23%         19 /abc/lel_11.py  +  function12                                            21.604KB 63.08%  1.117KB3.26%         18 /abc/lel_12.py  +  function13                                            20.486KB 59.82%  1.127KB3.29%         17 /abc/lel_13.py  +  function14                                            19.359KB 56.53%  1.137KB3.32%         16 /abc/lel_14.py  +  function15                                            18.223KB 53.21%  1.146KB3.35%         15 /abc/lel_15.py  +  function16                                            17.076KB 49.86%  1.156KB3.38%         14 /abc/lel_16.py  +  function17                                            15.920KB 46.48%  1.166KB3.40%         13 /abc/lel_17.py  +  function18                                            14.754KB 43.08%  1.176KB3.43%         12 /abc/lel_18.py  +  function19                                            13.578KB 39.65%  1.186KB3.46%         11 /abc/lel_19.py  +  function20                                            12.393KB 36.18%  1.195KB3.49%         10 /abc/lel_20.py  +  function21                                            11.197KB 32.69%  1.205KB3.52%          9 /abc/lel_21.py  +  function22                                             9.992KB 29.18%  1.215KB3.55%          8 /abc/lel_22.py  +  function23                                             8.777KB 25.63%  1.225KB3.58%          7 /abc/lel_23.py  +  function24                                             7.553KB 22.05%  1.234KB3.60%          6 /abc/lel_24.py  +  function25                                             6.318KB 18.45%  1.244KB3.63%          5 /abc/lel_25.py  +  function26                                             5.074KB 14.82%  1.254KB3.66%          4 /abc/lel_26.py  +  function27                                             3.820KB 11.15%  1.264KB3.69%          3 /abc/lel_27.py  +  function28                                             2.557KB  7.47%  1.273KB3.72%          2 /abc/lel_28.py  +  function29                                             1.283KB  3.75%  1.283KB3.75%          1 /abc/lel_29.py  +  Q  Quit  <  Previous Thread  >  Next Thread  T  Sort by Total  O  Sort by Own  A  Sort by Allocations  @@ -961,138 +961,138 @@ font-weight: 700; } - .terminal-1181498411-matrix { + .terminal-2056010829-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-1181498411-title { + .terminal-2056010829-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-1181498411-r1 { fill: #e1e1e1;font-weight: bold } - .terminal-1181498411-r2 { fill: #e1e1e1 } - .terminal-1181498411-r3 { fill: #c5c8c6 } - .terminal-1181498411-r4 { fill: #c5a635 } - .terminal-1181498411-r5 { fill: #64d484 } - .terminal-1181498411-r6 { fill: #dde6ed;font-weight: bold } - .terminal-1181498411-r7 { fill: #e1e2e3 } - .terminal-1181498411-r8 { fill: #e1f0ff;font-weight: bold } + .terminal-2056010829-r1 { fill: #e1e1e1;font-weight: bold } + .terminal-2056010829-r2 { fill: #e1e1e1 } + .terminal-2056010829-r3 { fill: #c5c8c6 } + .terminal-2056010829-r4 { fill: #c5a635 } + .terminal-2056010829-r5 { fill: #64d484 } + .terminal-2056010829-r6 { fill: #dde6ed;font-weight: bold } + .terminal-2056010829-r7 { fill: #e1e2e3 } + .terminal-2056010829-r8 { fill: #e1f0ff;font-weight: bold } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - MockApp + MockApp - - - - Memray live tracki    Fri Oct 13 12:00:00 2023 - PID: ???CMD: ??? - TID: 0x1Thread 1 of 1 - Samples: 2Duration: 42.0 seconds - StatusTable updates paused - -  Heap Usage ───────────────────────────────── -                                              ▐ -                                              ▐ -                                              ▟ -                                              █ - ────────────── 3.000KB (100% of 3.000KB max)  -                       Location                   -  malloc                                          -  f1                                              -  parent                                          -  grandparent                                     - - - - - - -  Q  Quit  <  Previous Thread  >  Next Thread  T… + + + + Memray live tracki    Fri Oct 13 12:00:00 2023 + PID: ???CMD: ??? + TID: 0x1Thread 1 of 1 (1) + Samples: 2Duration: 42.0 seconds + StatusTable updates paused + +  Heap Usage ───────────────────────────────── +                                              ▐ +                                              ▐ +                                              ▟ +                                              █ + ────────────── 3.000KB (100% of 3.000KB max)  +                       Location                   +  malloc                                          +  f1                                              +  parent                                          +  grandparent                                     + + + + + + +  Q  Quit  <  Previous Thread  >  Next Thread  T… @@ -1122,140 +1122,140 @@ font-weight: 700; } - .terminal-3247494613-matrix { + .terminal-4261205495-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-3247494613-title { + .terminal-4261205495-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-3247494613-r1 { fill: #e1e1e1;font-weight: bold } - .terminal-3247494613-r2 { fill: #e1e1e1 } - .terminal-3247494613-r3 { fill: #c5c8c6 } - .terminal-3247494613-r4 { fill: #c5a635 } - .terminal-3247494613-r5 { fill: #be3f48 } - .terminal-3247494613-r6 { fill: #23568b } - .terminal-3247494613-r7 { fill: #64d484 } - .terminal-3247494613-r8 { fill: #dde6ed;font-weight: bold } - .terminal-3247494613-r9 { fill: #e1e2e3 } - .terminal-3247494613-r10 { fill: #e1f0ff;font-weight: bold } + .terminal-4261205495-r1 { fill: #e1e1e1;font-weight: bold } + .terminal-4261205495-r2 { fill: #e1e1e1 } + .terminal-4261205495-r3 { fill: #c5c8c6 } + .terminal-4261205495-r4 { fill: #c5a635 } + .terminal-4261205495-r5 { fill: #be3f48 } + .terminal-4261205495-r6 { fill: #23568b } + .terminal-4261205495-r7 { fill: #64d484 } + .terminal-4261205495-r8 { fill: #dde6ed;font-weight: bold } + .terminal-4261205495-r9 { fill: #e1e2e3 } + .terminal-4261205495-r10 { fill: #e1f0ff;font-weight: bold } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - MockApp + MockApp - - - - Memray live tracki    Fri Oct 13 12:00:00 2023 - PID: ???CMD: ??? - TID: 0x1Thread 1 of 1 - Samples: 2Duration: 42.0 seconds - StatusTable updates pausedRemote has disconne - -  Heap Usage ───────────────────────────────── -                                              ▐ -                                              ▐ -                                              ▟ -                                              █ - ────────────── 3.000KB (100% of 3.000KB max)  -                       Location                   -  malloc                                          -  f1                                              -  parent                                          -  grandparent                                     - - - - - - -  Q  Quit  <  Previous Thread  >  Next Thread  T… + + + + Memray live tracki    Fri Oct 13 12:00:00 2023 + PID: ???CMD: ??? + TID: 0x1Thread 1 of 1 (1) + Samples: 2Duration: 42.0 seconds + StatusTable updates pausedRemote has disconne + +  Heap Usage ───────────────────────────────── +                                              ▐ +                                              ▐ +                                              ▟ +                                              █ + ────────────── 3.000KB (100% of 3.000KB max)  +                       Location                   +  malloc                                          +  f1                                              +  parent                                          +  grandparent                                     + + + + + + +  Q  Quit  <  Previous Thread  >  Next Thread  T… @@ -1285,144 +1285,144 @@ font-weight: 700; } - .terminal-2550970206-matrix { + .terminal-4242716544-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-2550970206-title { + .terminal-4242716544-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-2550970206-r1 { fill: #e1e1e1;font-weight: bold } - .terminal-2550970206-r2 { fill: #e1e1e1 } - .terminal-2550970206-r3 { fill: #c5c8c6 } - .terminal-2550970206-r4 { fill: #00ff00 } - .terminal-2550970206-r5 { fill: #64d484 } - .terminal-2550970206-r6 { fill: #c5a635 } - .terminal-2550970206-r7 { fill: #be3f48 } - .terminal-2550970206-r8 { fill: #dde6ed;font-weight: bold } - .terminal-2550970206-r9 { fill: #dde6ed;font-weight: bold;text-decoration: underline; } - .terminal-2550970206-r10 { fill: #e1e2e3 } - .terminal-2550970206-r11 { fill: #cd5c5c } - .terminal-2550970206-r12 { fill: #61c12c } - .terminal-2550970206-r13 { fill: #23568b } - .terminal-2550970206-r14 { fill: #e1f0ff;font-weight: bold } + .terminal-4242716544-r1 { fill: #e1e1e1;font-weight: bold } + .terminal-4242716544-r2 { fill: #e1e1e1 } + .terminal-4242716544-r3 { fill: #c5c8c6 } + .terminal-4242716544-r4 { fill: #00ff00 } + .terminal-4242716544-r5 { fill: #64d484 } + .terminal-4242716544-r6 { fill: #c5a635 } + .terminal-4242716544-r7 { fill: #be3f48 } + .terminal-4242716544-r8 { fill: #dde6ed;font-weight: bold } + .terminal-4242716544-r9 { fill: #dde6ed;font-weight: bold;text-decoration: underline; } + .terminal-4242716544-r10 { fill: #e1e2e3 } + .terminal-4242716544-r11 { fill: #cd5c5c } + .terminal-4242716544-r12 { fill: #61c12c } + .terminal-4242716544-r13 { fill: #23568b } + .terminal-4242716544-r14 { fill: #e1f0ff;font-weight: bold } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - MockApp + MockApp - - - - Memray live tracking      Fri Oct 13 12:00:00 2023 -  (∩`-´)⊃━☆゚.*・。゚  Heap Usage ───────── - PID: ???CMD: ???                     ▐ - TID: 0x1Thread 1 of 1                     ▐ - Samples: 2Duration: 42.0 seconds                     ▟ - StatusTable updates pausedRemote has disconnected                     █ -  3.000KB (100% of …  - -                       Location                      Total Bytes% TotalOwn By -  malloc                                                 1.000KB100.00%  1.00 -  f1                                                     1.000KB100.00%   0.0 -  parent                                                 1.000KB100.00%   0.0 -  grandparent                                            1.000KB100.00%   0.0 - - - - - - - - - - -  Q  Quit  <  Previous Thread  >  Next Thread  T  Sort by Total  O  Sort by Own  … + + + + Memray live tracking      Fri Oct 13 12:00:00 2023 +  (∩`-´)⊃━☆゚.*・。゚  Heap Usage ───────── + PID: ???CMD: ???                     ▐ + TID: 0x1Thread 1 of 1 (1)                     ▐ + Samples: 2Duration: 42.0 seconds                     ▟ + StatusTable updates pausedRemote has disconnected                     █ +  3.000KB (100% of …  + +                       Location                      Total Bytes% TotalOwn By +  malloc                                                 1.000KB100.00%  1.00 +  f1                                                     1.000KB100.00%   0.0 +  parent                                                 1.000KB100.00%   0.0 +  grandparent                                            1.000KB100.00%   0.0 + + + + + + + + + + +  Q  Quit  <  Previous Thread  >  Next Thread  T  Sort by Total  O  Sort by Own  … diff --git a/tests/unit/test_tui_reporter.py b/tests/unit/test_tui_reporter.py index 88aa747e3e..47ee04fc8d 100644 --- a/tests/unit/test_tui_reporter.py +++ b/tests/unit/test_tui_reporter.py @@ -559,7 +559,7 @@ async def run_test(): # THEN assert labels["tid"].split() == "TID: 0x0".split() - assert labels["thread"].split() == "Thread 1 of 1".split() + assert labels["thread"].split() == "Thread 1 of 1 (0)".split() assert labels["samples"].split() == "Samples: 0".split() @@ -580,7 +580,7 @@ async def run_test(): # THEN assert labels["tid"].split() == "TID: 0x0".split() - assert labels["thread"].split() == "Thread 1 of 1".split() + assert labels["thread"].split() == "Thread 1 of 1 (0)".split() assert labels["samples"].split() == "Samples: 1".split() @@ -688,7 +688,7 @@ async def run_test(): order = [0, 1, 2, 0, 2, 1, 0] assert functions == ["abc"[i] for i in order] assert tids == [f"TID: {hex(i+1)}" for i in order] - assert threads == [f"Thread {i+1} of 3" for i in order] + assert threads == [f"Thread {i+1} of 3 ({i+1})" for i in order] @pytest.mark.parametrize(