Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display system RAM speed in MHz #543

Open
Faalagorn opened this issue Jun 13, 2021 · 5 comments
Open

Display system RAM speed in MHz #543

Faalagorn opened this issue Jun 13, 2021 · 5 comments

Comments

@Faalagorn
Copy link
Contributor

Since 0.6.2 and 0.6.3 it is not possible to show SWAP amount which fills the gap next to RAM amount which is a nice feature.

However, especially for systemws without swap or for those who don't want to show it, how about an option to display the system memory speed in MHz, similar to VRAM?

I keep finding dmidecode or lshw for that, both of which require root to run. Is it possible to retrieve that info without root access?

@stephanlachnit
Copy link
Contributor

stephanlachnit commented Jun 17, 2021

This could be solved by using polkit (see https://www.freedesktop.org/software/polkit/docs/latest/polkit.8.html). If you add this configuration as io.github.flightlessmango.mangohud.policy to /usr/share/polkit-1/actions/:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD polkit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/software/polkit/policyconfig-1.dtd">

<policyconfig>

  <action id="io.github.flightlessmango.mangohud.lshw">
    <description>Get hardware information</description>
    <message>Authentication is required to get full hardware information</message>
    <defaults>
      <allow_any>no</allow_any>
      <allow_inactive>no</allow_inactive>
      <allow_active>yes</allow_active>
    </defaults>
    <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/lshw</annotate>
  </action>

</policyconfig>

it would allow to run lshw as root without user authentication and without granting general root rights.

The next problem would be parsing lshw. lshw -sanitize -C memory gives the output you will get, which for me also contains cpu caches. It would probably format it using -xml or -json. Parsing it using nlohmann-json probably makes the most sense.

(And of course, you would need a dbus interface.)

@flightlessmango
Copy link
Owner

» lshw -sanitize -C memory
WARNING: you should run this program as super-user.
  *-memory
       description: System memory
       physical id: 0
       size: 32GiB
  *-memory UNCLAIMED
       description: Memory controller
       product: 200 Series/Z370 Chipset Family Power Management Controller
       vendor: Intel Corporation
       physical id: 1f.2
       bus info: pci@0000:00:1f.2
       version: 00
       width: 32 bits
       clock: 33MHz (30.3ns)
       capabilities: bus_master
       configuration: latency=0
       resources: memory:f7a20000-f7a23fff

I don't see memory frequency in this, is it still possible to get with lshw?

@stephanlachnit
Copy link
Contributor

» lshw -sanitize -C memory
WARNING: you should run this program as super-user.
  *-memory
       description: System memory
       physical id: 0
       size: 32GiB
  *-memory UNCLAIMED
       description: Memory controller
       product: 200 Series/Z370 Chipset Family Power Management Controller
       vendor: Intel Corporation
       physical id: 1f.2
       bus info: pci@0000:00:1f.2
       version: 00
       width: 32 bits
       clock: 33MHz (30.3ns)
       capabilities: bus_master
       configuration: latency=0
       resources: memory:f7a20000-f7a23fff

I don't see memory frequency in this, is it still possible to get with lshw?

Run as root:

  *-memory
       description: System Memory
       physical id: b
       slot: System board or motherboard
       size: 32GiB
     *-bank:0
          description: [empty]
          product: Unknown
          vendor: Unknown
          physical id: 0
          serial: [REMOVED]
          slot: DIMM 0
     *-bank:1
          description: DIMM DDR4 Synchronous Unbuffered (Unregistered) 3200 MHz (0.3 ns)
          product: F4-3200C16-16GIS
          vendor: Unknown
          physical id: 1
          serial: [REMOVED]
          slot: DIMM 1
          size: 16GiB
          width: 64 bits
          clock: 3200MHz (0.3ns)
     *-bank:2
          description: [empty]
          product: Unknown
          vendor: Unknown
          physical id: 2
          serial: [REMOVED]
          slot: DIMM 0
     *-bank:3
          description: DIMM DDR4 Synchronous Unbuffered (Unregistered) 3200 MHz (0.3 ns)
          product: F4-3200C16-16GIS
          vendor: Unknown
          physical id: 3
          serial: [REMOVED]
          slot: DIMM 1
          size: 16GiB
          width: 64 bits
          clock: 3200MHz (0.3ns)

Gives you the clock per bank though. The root access problem can be solved via polkit as posted before.

@light-and-ray
Copy link

Can you add feature to display ram bus usage in %?

@flightlessmango
Copy link
Owner

Can you add feature to display ram bus usage in %?

What does that mean and how would you measure it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants