Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Verified on an RK3326 handheld (Mali-G31, panfrost, kernel 6.12). I have no RK3588 to test on, so the vendor driver path there is reasoned about rather than measured; please check it.
Closes #2.
Devfreq nodes
The GPU and NPU paths were hardcoded to the RK3588 addresses, so frequency read as unavailable on other SoCs (RK3326 uses
ff400000.gpu). Resolved by the driver bound to the device instead: DRM cards first, then the devfreq class, then the device treecompatiblestring. The original paths stay as a last resort so this cannot regress hardware I could not test.SoC
get_rk_modellooked forRKxxxxin the board model string, which only works when the vendor puts it there. This board reportsGame Console R36S, and the Orange Pi 5 Plus in #2 reportsOrange Pi 5 Plus. Reads/proc/device-tree/compatibleinstead, walking it in reverse so the SoC entry is found before the board entry. Also accepts thepxandrvprefixes.GPU utilisation
get_gpu_usageread only/sys/kernel/debug/mali0/dvfs_utilization, which the vendor driver provides and panfrost and panthor do not, so utilisation was permanently unavailable there. Falls back to the per clientdrm-engine-*counters in DRM fdinfo. The panel also gated on utilisation being present, so it was hidden entirely rather than showing the frequency.Measured under a fragment bound Vulkan load: 98.7% fragment, 1.1% vertex-tiler, against 0% idle.
Two caveats worth knowing: panfrost and panthor gate these counters behind the device's
profilingattribute, and where it is off every engine reads as idle; and the summary reports the busiest engine rather than the sum, because vertex/tiler and fragment run on separate job slots that overlap.The fdinfo path is skipped entirely when the vendor debugfs is present, so this costs nothing on hardware that already worked.
CPU cost
rktop used about 5% at rest on this device (4x Cortex-A35). Timing each data source put nearly all of it in one place: building the process table cost 32 ms, which at one redraw per second is most of the total.
/proc/<pid>/statwas read three times per process, once each for the nice value, the CPU core and the state./proc/<pid>/statuswas read per process forTgidalone. A pid listed in/procis its own thread group leader, and sysinfo already records the owning process as a task's parent, so no read is needed. Validated againstTgidfor every process on this system: 189 checked, 0 mismatched.This also fixes a latent bug: stat fields were located by splitting the whole line, but the second field is the command name in parentheses and may contain spaces, which shifts every later field and yields another process's nice value and CPU core. Fields are now located relative to the last
).5.0% before, 4.1% after, while additionally sampling GPU utilisation.