a2qlinux 0.7.1__tar.gz → 0.7.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/CHANGELOG.md +7 -0
  2. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/PKG-INFO +1 -1
  3. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/a2qlinux/_version.py +2 -2
  4. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/a2qlinux/bin/questlog_ctl.exe +0 -0
  5. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/a2qlinux/bin/wpcap.dll +0 -0
  6. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/a2qlinux/diagnose.py +90 -4
  7. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/docs/ARCHITECTURE.md +46 -2
  8. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/docs/RELEASE.md +5 -1
  9. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/docs/TROUBLESHOOTING.md +6 -0
  10. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/tests/test_diagnose.py +47 -0
  11. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/.gitignore +0 -0
  12. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/LICENSE +0 -0
  13. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/README.md +0 -0
  14. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/a2qlinux/__init__.py +0 -0
  15. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/a2qlinux/config.py +0 -0
  16. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/a2qlinux/desktop.py +0 -0
  17. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/a2qlinux/kde_overlays.py +0 -0
  18. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/a2qlinux/launcher.py +0 -0
  19. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/a2qlinux/open_folders.py +0 -0
  20. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/a2qlinux/pcap_bridge.py +0 -0
  21. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/a2qlinux/setup_desktop.py +0 -0
  22. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/a2qlinux/steam.py +0 -0
  23. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/a2qlinux/tray.py +0 -0
  24. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/a2qlinux/update.py +0 -0
  25. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/bridge/build.sh +0 -0
  26. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/bridge/questlog_ctl.c +0 -0
  27. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/bridge/tests/bridge_client_test.c +0 -0
  28. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/bridge/tests/zorder_guard_test.c +0 -0
  29. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/bridge/wpcap_bridge.c +0 -0
  30. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/docs/INSTALL.md +0 -0
  31. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/docs/README.md +0 -0
  32. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/docs/UPDATING.md +0 -0
  33. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/docs/USING.md +0 -0
  34. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/pyproject.toml +0 -0
  35. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/tests/__init__.py +0 -0
  36. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/tests/test_config.py +0 -0
  37. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/tests/test_desktop.py +0 -0
  38. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/tests/test_kde_overlays.py +0 -0
  39. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/tests/test_launcher.py +0 -0
  40. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/tests/test_open_folders.py +0 -0
  41. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/tests/test_pcap_bridge.py +0 -0
  42. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/tests/test_replay_stream.py +0 -0
  43. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/tests/test_setup_desktop.py +0 -0
  44. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/tests/test_steam.py +0 -0
  45. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/tests/test_update.py +0 -0
  46. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/tests/test_version.py +0 -0
  47. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/tools/__init__.py +0 -0
  48. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/tools/pcap2questlog.py +0 -0
  49. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/tools/replay_stream.py +0 -0
  50. {a2qlinux-0.7.1 → a2qlinux-0.7.2}/tools/tcp_owner_probe.c +0 -0
@@ -3,6 +3,13 @@
3
3
  What changed for players, release by release. Technical details are in
4
4
  `docs/ARCHITECTURE.md`.
5
5
 
6
+ ## [0.7.2] — 2026-11-13
7
+
8
+ ### Changed
9
+ - `a2qlinux --diagnose --report` also records what each part of Questlog
10
+ is doing at that moment. When a Questlog window turns black or is "not
11
+ responding", a report made while it is on screen shows what it waits for.
12
+
6
13
  ## [0.7.1] — 2026-11-13
7
14
 
8
15
  ### Fixed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: a2qlinux
3
- Version: 0.7.1
3
+ Version: 0.7.2
4
4
  Summary: Questlog Desktop (AION 2 damage meter) on Linux under Proton, with live game traffic.
5
5
  Project-URL: homepage, https://github.com/raman78/A2Qlinux
6
6
  Project-URL: repository, https://github.com/raman78/A2Qlinux
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '0.7.1'
22
- __version_tuple__ = version_tuple = (0, 7, 1)
21
+ __version__ = version = '0.7.2'
22
+ __version_tuple__ = version_tuple = (0, 7, 2)
23
23
 
24
24
  __commit_id__ = commit_id = None
@@ -19,9 +19,10 @@ not. Each check gives one line: fine, a note, or a problem with what to do.
19
19
  7. Whether the game's prefix has a command for Questlog's Open Folder
20
20
  buttons, read from its system.reg (no Wine is started).
21
21
 
22
- With --report it also writes a report file: the diagnosis and the end of
23
- launcher.log and of questlog.log and questlog.log.1 (Questlog's and Wine's
24
- output, this run and the one before), with the home folder, user name, Steam account numbers and
22
+ With --report it also writes a report file: the diagnosis, a snapshot of
23
+ what each of Questlog's processes and threads is doing (process_snapshot),
24
+ and the end of launcher.log and of questlog.log and questlog.log.1
25
+ (Questlog's and Wine's output, this run and the one before), with the home folder, user name, Steam account numbers and
25
26
  network addresses replaced (anonymise). It shows the report and, if the
26
27
  user agrees, opens a new GitHub issue in the browser with the report filled
27
28
  in; the user reviews it and submits it with their own account. Nothing is
@@ -632,12 +633,97 @@ def questlog_log_excerpt(path, head=QUESTLOG_LOG_HEAD, tail=QUESTLOG_LOG_TAIL):
632
633
  return lines[:head] + [f"(... {len(lines) - head - tail} lines left out ...)"] + lines[-tail:]
633
634
 
634
635
 
635
- def build_report(results, qdir, anonymise):
636
+ PROCESS_SAMPLE = 1.0 # s between the two readings of the threads' CPU time in the report's snapshot
637
+
638
+
639
+ def process_role(argv):
640
+ """What a process of Questlog is, from its command line: main, gpu-process, renderer, utility (…)."""
641
+ kind = next((a.split("=", 1)[1] for a in argv if a.startswith("--type=")), None)
642
+ if kind is None:
643
+ return "wineserver" if argv and argv[0].endswith("wineserver") else "main"
644
+ sub = next((a.split("=", 1)[1] for a in argv if a.startswith("--utility-sub-type=")), "")
645
+ return f"{kind} ({sub.split('.')[0]})" if sub else kind
646
+
647
+
648
+ def _thread_readings(pid, proc):
649
+ """{tid: (name, state, kernel wait, CPU ticks)} of one process's threads; {} once it has gone."""
650
+ readings = {}
651
+ try:
652
+ tids = os.listdir(f"{proc}/{pid}/task")
653
+ except OSError:
654
+ return readings
655
+ for tid in tids:
656
+ base = f"{proc}/{pid}/task/{tid}"
657
+ try:
658
+ stat = Path(base, "stat").read_text()
659
+ fields = stat[stat.rindex(")") + 2:].split()
660
+ name = Path(base, "comm").read_text().strip()
661
+ wchan = Path(base, "wchan").read_text().strip()
662
+ except (OSError, ValueError):
663
+ continue
664
+ readings[int(tid)] = (name, fields[0], wchan if wchan not in ("", "0") else "-",
665
+ int(fields[11]) + int(fields[12]))
666
+ return readings
667
+
668
+
669
+ def process_snapshot(pids, proc="/proc", wait=PROCESS_SAMPLE, sleep=time.sleep, ticks=None):
670
+ """The report's lines on what each of Questlog's processes and threads does right now.
671
+
672
+ Each thread: its name (Chromium names them: CrBrowserMain is the main
673
+ process's window thread), its state (R running, S/D waiting), where it
674
+ waits in the kernel, and the CPU time it used between two readings
675
+ `wait` s apart. A thread that answers no window shows either as busy
676
+ (CPU time near the whole interval) or as waiting with none. Idle threads
677
+ that look alike are counted on one line.
678
+ """
679
+ from .launcher import _read
680
+ ticks = ticks or os.sysconf("SC_CLK_TCK")
681
+ first = {pid: _thread_readings(pid, proc) for pid in pids}
682
+ sleep(wait)
683
+ lines = []
684
+ for pid in sorted(pids):
685
+ argv = [a for a in _read(f"{proc}/{pid}/cmdline", 4096).split("\0") if a]
686
+ second = _thread_readings(pid, proc)
687
+ if not second:
688
+ lines.append(f"PID {pid}: gone during the snapshot")
689
+ continue
690
+ used = {tid: max(0, second[tid][3] - first[pid].get(tid, second[tid])[3]) * 1000 // ticks
691
+ for tid in second}
692
+ lines.append(f"PID {pid} {process_role(argv)}: {len(second)} threads, "
693
+ f"{sum(used.values())} ms CPU in {wait:g} s")
694
+ grouped = {}
695
+ for tid in sorted(second):
696
+ name, state, wchan, _ = second[tid]
697
+ if tid == pid or used[tid] or state not in ("S", "I"):
698
+ lines.append(f" {tid:>8} {name:<16} {state} {wchan:<32} {used[tid]:>5} ms")
699
+ else:
700
+ grouped[(name, state, wchan)] = grouped.get((name, state, wchan), 0) + 1
701
+ for (name, state, wchan), count in sorted(grouped.items()):
702
+ lines.append(f" {'x' + str(count):>8} {name:<16} {state} {wchan:<32} {0:>5} ms")
703
+ return lines
704
+
705
+
706
+ def questlog_snapshot(appid=3393110):
707
+ """process_snapshot of Questlog's processes and the Wine session's wineserver; lines."""
708
+ from . import launcher
709
+ found = launcher.game_processes(appid, ["questlog.exe", "wineserver"])
710
+ servers = {pid for pid in found["wineserver"]
711
+ if "-w" not in launcher._read(f"/proc/{pid}/cmdline", 4096).split("\0")[1:]}
712
+ pids = found["questlog.exe"] | servers
713
+ if not found["questlog.exe"]:
714
+ return ["(Questlog is not running)"]
715
+ return process_snapshot(pids)
716
+
717
+
718
+ def build_report(results, qdir, anonymise, snapshot=questlog_snapshot):
636
719
  logs = qdir / "proton-stream"
637
720
  launcher_lines = log_tail(logs / "launcher.log", REPORT_LOG_LINES)
638
721
  parts = [f"A2Qlinux report, {time.strftime('%Y-%m-%d %H:%M %Z')}", "", "## Diagnosis", "",
639
722
  format_results(results), "", f"## launcher.log (last {REPORT_LOG_LINES} lines)", ""]
640
723
  parts += launcher_lines or ["(no launcher.log yet)"]
724
+ parts += ["", f"## Questlog's processes now (threads: state, kernel wait, CPU time in {PROCESS_SAMPLE:g} s)",
725
+ ""]
726
+ parts += snapshot()
641
727
  parts += ["", "## steam_launch.log (last 10 lines)", ""]
642
728
  parts += log_tail(logs / "steam_launch.log", 10) or ["(none)"]
643
729
  parts += ["", "## questlog.log (Questlog's and Wine's output since A2Qlinux last started it)", ""]
@@ -1389,6 +1389,7 @@ one** — §6.4.
1389
1389
  | who owns the game connection | `tools/tcp_owner_probe.exe` in the prefix |
1390
1390
  | KDE overlays (§6.8) | `tests/test_kde_overlays.py` runs against stand-ins for KDE's config tools and `dbus-send`, and, where `kwriteconfig6` is installed, checks with the real tools that removal gives the rule file back byte for byte; on the desktop, a one-off KWin script that prints the HUD's `layer` and `opacity` shows what KWin applied |
1391
1391
  | folder handler (§6.10) | `tests/test_open_folders.py` (the setup step against a stand-in for `questlog_ctl.exe`; `registry_state` on `system.reg` text as Wine saves it; the value in Python equal to the one in `questlog_ctl.c`); the command itself in a throwaway prefix: `WINEPREFIX=<throwaway> wine questlog_ctl.exe folder-handler status` (then `set`, `remove`), and a test program making Chromium's call (`ShellExecuteExW`, verb `explore`, class `folder`, `SEE_MASK_IDLIST`) with a stand-in `xdg-open` first in `PATH` that records its argument |
1392
+ | process snapshot (§9.1) | `ProcessSnapshotTest` in `tests/test_diagnose.py` against a fake `/proc` tree (CPU time from the difference of the two readings, idle threads counted together, a process that ends between the readings); on a running Questlog, `python3 -c "from a2qlinux import diagnose; print('\n'.join(diagnose.questlog_snapshot()))"` |
1392
1393
  | does the session survive a quit (§5.1) | without the game: a Windows program that only waits, started as `systemd-run --user --unit=<name> protontricks-launch --appid 3393110 <program>.exe`, plays the game; quit Questlog and check that the program, the `wineserver` and `explorer.exe /desktop` run on, and which unit holds them (`/proc/<pid>/cgroup`) |
1393
1394
  | a stuck process (§6.9) | `gdb -p <pid> -batch -ex bt` as root (`ptrace_scope` 1 allows a user to trace only their own children); A2Qlinux never does this itself |
1394
1395
  | Wine's view of windows and focus | run `WINEDEBUG=+event,+x11drv,+win a2qlinux-run`; the log grows about 40 KB/s, so only briefly |
@@ -1523,8 +1524,8 @@ when there is a problem. A check that raises is reported as a problem
1523
1524
  itself instead of hiding the checks after it.
1524
1525
 
1525
1526
  **`--report`.** Writes `~/a2qlinux-report-<date>-<time>.txt`: the
1526
- diagnosis, the last `REPORT_LOG_LINES` (400) lines of `launcher.log`, the
1527
- last 10 of `steam_launch.log`, `questlog.log` (`questlog_log_excerpt`:
1527
+ diagnosis, the last `REPORT_LOG_LINES` (400) lines of `launcher.log`, a
1528
+ snapshot of Questlog's processes (below), the last 10 of `steam_launch.log`, `questlog.log` (`questlog_log_excerpt`:
1528
1529
  whole up to `QUESTLOG_LOG_HEAD` + `QUESTLOG_LOG_TAIL` lines, 400 + 800,
1529
1530
  else its start, where DXVK names its device and Chromium starts its GPU
1530
1531
  process, and its end, the gap marked) and `questlog.log.1`, the run
@@ -1552,6 +1553,49 @@ login page, which carries the whole URL along) and answered 7000 with an
1552
1553
  error 500. `ISSUE_URL_LIMIT` is 6000; the full log is in the attached file.
1553
1554
  If even the diagnosis does not fit, it is cut with a line saying so.
1554
1555
 
1556
+ **The process snapshot** (`questlog_snapshot`, `process_snapshot`, the
1557
+ report's section "Questlog's processes now"). The logs show how Questlog
1558
+ started, not what it is doing now; a Questlog that misbehaves while it
1559
+ runs, such as a main window that turns black during play and that GNOME
1560
+ calls "not responding" while the overlays keep drawing (issue #2), needs
1561
+ the second. The snapshot lists Questlog's processes in the game prefix
1562
+ and the Wine session's `wineserver`: the one without `-w`, since
1563
+ `wineserver -w` processes only wait for the session to end (§5.1).
1564
+
1565
+ Each process gets a role from its command line (`process_role`): `main`
1566
+ without `--type=`, else the `--type=` value, with the utility's sub-type
1567
+ (`utility (network)`). Each thread gets four values from
1568
+ `/proc/<pid>/task/<tid>`:
1569
+
1570
+ | Value | From | Meaning |
1571
+ |---|---|---|
1572
+ | name | `comm` | Chromium names its threads; the main process's first thread (thread id = PID) is `CrBrowserMain`, Chromium's UI thread, which runs Questlog's windows |
1573
+ | state | `stat` | `R` running, `S` sleeping, `D` waiting uninterruptibly (usually in a driver) |
1574
+ | kernel wait | `wchan` | the kernel function a sleeping thread waits in; `-` when running |
1575
+ | CPU time | `stat` (`utime` + `stime`) | used between two readings `PROCESS_SAMPLE` (1 s) apart, in ms |
1576
+
1577
+ The first thread of each process, and every thread that used CPU time or
1578
+ is not sleeping, get a line each; the remaining idle threads are counted
1579
+ per name, state and wait (`x16 ThreadPoolForeg S ntsync_schedule…`), which
1580
+ keeps about 300 threads readable. Everything read is open to the user's
1581
+ own processes. The thread's current system call (`/proc/…/syscall`)
1582
+ would tell more but needs ptrace rights, which Yama's default
1583
+ (`ptrace_scope` 1) refuses for processes that are not one's children.
1584
+
1585
+ What it can tell: a window thread that is busy shows CPU time near the
1586
+ whole second; one blocked inside the graphics driver shows a wait
1587
+ function of that driver. What it cannot tell: a thread
1588
+ waiting for its next window message and one blocked on a Windows lock
1589
+ look the same. Both wait in `ntsync_schedule` (ntsync is the kernel
1590
+ driver through which Wine implements Windows synchronisation objects;
1591
+ without it, `__futex_wait`) and use no CPU time. Telling those two apart
1592
+ needs a question asked inside Wine (whether Windows considers the window
1593
+ hung), which the report does not ask, since `--diagnose` starts no Wine.
1594
+ For comparison, a healthy Questlog with the game running (13 November
1595
+ 2026, proton-cachyos-slr, KDE): the main process's `CrBrowserMain` in
1596
+ `ntsync_schedule`, 10 to 60 ms of CPU time per second; the GPU process's
1597
+ `CrGpuMain` in `ntsync_schedule` with none.
1598
+
1555
1599
  ## 10. What Questlog updates can break
1556
1600
 
1557
1601
  A2Qlinux depends on these properties of Questlog. `compatibility_problems`
@@ -127,7 +127,7 @@ is not touched, and check that the Windows parts came with it:
127
127
 
128
128
  ```bash
129
129
  mkdir -p /tmp/a2q-check
130
- PIPX_HOME=/tmp/a2q-check/home PIPX_BIN_DIR=/tmp/a2q-check/bin pipx install a2qlinux==X.Y.Z
130
+ PIPX_HOME=/tmp/a2q-check/home PIPX_BIN_DIR=/tmp/a2q-check/bin pipx install --pip-args="--no-cache-dir" a2qlinux==X.Y.Z
131
131
  /tmp/a2q-check/home/venvs/a2qlinux/bin/python -I -c "import a2qlinux, pathlib; print(a2qlinux.__file__, a2qlinux.__version__, sorted(p.name for p in (pathlib.Path(a2qlinux.__path__[0]) / 'bin').iterdir()))"
132
132
  # /tmp/a2q-check/home/venvs/…/site-packages/a2qlinux/__init__.py X.Y.Z ['questlog_ctl.exe', 'wpcap.dll']
133
133
  rm -rf /tmp/a2q-check
@@ -138,6 +138,10 @@ directory: run from the repository root without it, the check reads the
138
138
  checkout's stale `_version.py` instead of the installed package (seen at
139
139
  the 0.6.0 release, which showed `0.4.1.dev2`). The path printed first
140
140
  must lie under `/tmp/a2q-check`.
141
+ `--no-cache-dir`: pip keeps the list of a project's versions for some
142
+ minutes, so right after an earlier install it answered "No matching
143
+ distribution found for a2qlinux==0.7.1" while PyPI already listed it
144
+ (0.7.1 release); without the cache it installed at once.
141
145
 
142
146
  If the `pypi` job failed while `build` passed, the release and its files
143
147
  are fine; fix the cause (usually the Trusted Publisher settings on pypi.org)
@@ -28,6 +28,7 @@ A2Qlinux, what causes them and what to do, followed by common questions.
28
28
  | `a2qlinux-setup` ends with "Note: KDE overlays: …" | KDE refused the change, or a KDE tool is missing; the note says which | everything else is set up; the cards stay hidden until the cause in the note is fixed |
29
29
  | "Questlog hung at its start: … Ending it and starting it again." in the status window | Questlog got stuck while starting, a rare fault in Wine | nothing; A2Qlinux has already started it again (see "If Questlog gets stuck while starting" in [USING.md](USING.md#starting-questlog)) |
30
30
  | notification "Questlog hung at its start 2 times in a row", the status window stays open | the same fault twice in a row, so A2Qlinux stopped trying | press Enter in the status window, then start "A2Qlinux" from the menu again; if it keeps happening, report it (below) |
31
+ | Questlog's main window turns black during play, and the desktop says it is "not responding"; the overlays keep working | not known yet: so far seen on GNOME only | make a report (below) while the window is black, before you close anything, and attach it to an issue |
31
32
  | Questlog closes right after starting | its graphics process failed | send `~/Games/Questlog/proton-stream/questlog.log` with your report |
32
33
  | notification "Questlog X does not fit this A2Qlinux yet" | the new Questlog changed something A2Qlinux relies on | keep using the current version; the reason is in the notification |
33
34
  | "Questlog update check failed" in the status window | no internet connection at that moment | nothing; it tries again later |
@@ -91,6 +92,11 @@ and Questlog's output from its last two starts, which shows how Questlog
91
92
  set up its graphics. A2Qlinux keeps only those two, so make the report
92
93
  soon after the problem, before you start A2Qlinux twice more.
93
94
 
95
+ It also records what each part of Questlog is doing at that moment. If
96
+ Questlog misbehaves while it runs (a window that turns black, freezes or
97
+ is "not responding"), make the report while the problem is on screen,
98
+ before you close anything: that snapshot is then the most useful part.
99
+
94
100
  Before writing the file, it replaces what could identify you: your home
95
101
  folder, user name, computer name, Steam account number and network
96
102
  addresses. Read it all the same. Then it asks whether to open a new issue on
@@ -330,3 +330,50 @@ class DisplayAndEnvironmentTest(unittest.TestCase):
330
330
  self.assertEqual(lines, [(d.OK, "Steam's environment: PROTON_ENABLE_WAYLAND=1"),
331
331
  (d.OK, "This session's environment (Questlog's): DXVK_HUD=fps, WINEDLLOVERRIDES=x=n")])
332
332
  self.assertIn("Steam is not running", d.environment_lines(env={}, steam_environ=None)[0][1])
333
+
334
+
335
+ class ProcessSnapshotTest(unittest.TestCase):
336
+ """process_snapshot on a fake /proc: two readings of each thread's CPU time, one `wait` apart."""
337
+
338
+ def write_thread(self, proc, pid, tid, name, state, wchan, ticks):
339
+ task = Path(proc, str(pid), "task", str(tid))
340
+ task.mkdir(parents=True, exist_ok=True)
341
+ # Fields after the name: state, then 10 others, then utime and stime (stat(5) fields 14, 15).
342
+ (task / "stat").write_text(f"{tid} ({name}) {state} " + "0 " * 10 + f"{ticks} 0 0 0\n")
343
+ (task / "comm").write_text(name + "\n")
344
+ (task / "wchan").write_text(wchan)
345
+
346
+ def test_busy_main_thread_and_grouped_idle_ones(self):
347
+ with tempfile.TemporaryDirectory() as proc:
348
+ main, gpu = 100, 200
349
+ Path(proc, str(main)).mkdir()
350
+ Path(proc, str(main), "cmdline").write_bytes(b"C:\\Questlog\\Questlog.exe\0--no-sandbox\0")
351
+ Path(proc, str(gpu)).mkdir()
352
+ Path(proc, str(gpu), "cmdline").write_bytes(b"C:\\Questlog\\Questlog.exe\0--type=gpu-process\0")
353
+ self.write_thread(proc, main, 100, "CrBrowserMain", "R", "0", 50)
354
+ for tid in (101, 102, 103):
355
+ self.write_thread(proc, main, tid, "ThreadPoolForeg", "S", "ntsync_schedule", 7)
356
+ self.write_thread(proc, gpu, 200, "CrGpuMain", "D", "dma_fence_default_wait", 3)
357
+
358
+ def sleep(_): # between the readings: the main thread runs for 90 of 100 ticks
359
+ self.write_thread(proc, main, 100, "CrBrowserMain", "R", "0", 140)
360
+ lines = d.process_snapshot({main, gpu}, proc=proc, wait=1, sleep=sleep, ticks=100)
361
+ self.assertEqual(lines[0], "PID 100 main: 4 threads, 900 ms CPU in 1 s")
362
+ self.assertRegex(lines[1], r"^\s+100 CrBrowserMain\s+R -\s+900 ms$")
363
+ self.assertRegex(lines[2], r"^\s+x3 ThreadPoolForeg\s+S ntsync_schedule\s+0 ms$")
364
+ self.assertEqual(lines[3], "PID 200 gpu-process: 1 threads, 0 ms CPU in 1 s")
365
+ self.assertRegex(lines[4], r"^\s+200 CrGpuMain\s+D dma_fence_default_wait\s+0 ms$")
366
+
367
+ def test_process_gone_between_readings(self):
368
+ with tempfile.TemporaryDirectory() as proc:
369
+ self.write_thread(proc, 300, 300, "CrBrowserMain", "S", "ntsync_schedule", 1)
370
+ lines = d.process_snapshot({300}, proc=proc, wait=1,
371
+ sleep=lambda _: __import__("shutil").rmtree(Path(proc, "300")), ticks=100)
372
+ self.assertEqual(lines, ["PID 300: gone during the snapshot"])
373
+
374
+ def test_roles(self):
375
+ self.assertEqual(d.process_role(["Q.exe"]), "main")
376
+ self.assertEqual(d.process_role(["Q.exe", "--type=renderer"]), "renderer")
377
+ self.assertEqual(d.process_role(["Q.exe", "--type=utility", "--utility-sub-type=network.mojom.NetworkService"]),
378
+ "utility (network)")
379
+ self.assertEqual(d.process_role(["/x/bin/wineserver"]), "wineserver")
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes