exelban / stats

macOS system monitor in your menu bar
MIT License
25.14k stars 830 forks source link

two issues of disk IO: update interval not working, system processes not showing #1941

Closed Dzhami-Jame-ALI closed 4 months ago

Dzhami-Jame-ALI commented 4 months ago

Describe the bug There are probably two issues in disk IO monitor:

  1. The update interval settings (in Disk - Module - Update Interval) does not work. Whatever value I choose, the menu bar icon will always update the value for every 1 second.
  2. The Top processes 's disk IO is not showing macOS system process like mds_stores. The I/O from top processes is significant different than menu bar icon's value in that case, e.g. menu bar shows 60MB/100MB R/W (actually by mds_stores), but drop down widget - top processes shows nothing.

Details:

exelban commented 4 months ago

Duplicate of #1942

Dzhami-Jame-ALI commented 4 months ago

@exelban Hello, for #issue2, it might be related to root permission:

            let result = withUnsafeMutablePointer(to: &usage) {
                $0.withMemoryRebound(to: (rusage_info_t?.self), capacity: 1) {
                    proc_pid_rusage(pid, RUSAGE_INFO_CURRENT, $0)
                }
            }
            guard result != -1 else { return }

If root permission is granted when building the program, those system processes like mds_stores will get reulst 0 rather than -1. Is it possible to consider adding a root-based helper as an option to this tool, like fan-helper?

exelban commented 4 months ago

First, if the guard check does not pass it means that Stats cannot get usage info. Second, nope. I'm avoiding the root access. And for the feature like that I will not add it for sure.

Why are you running the app under the root?

Dzhami-Jame-ALI commented 4 months ago

No offense, I'm just trying to get the reason why iStat Menus can get those system processes' disk IO (probably it requires installing a root-based helper). Sometimes when seeing the huge disk IO numbers in menus bar, it's natural to want to click and see the details.

exelban commented 4 months ago

No worry, I'm ready to help with fixing that. Looks like you run the Stats from the source?

exelban commented 4 months ago

I have a few reports that users do not have processes for disk. But have no idea why and do not see that problem on any of my Macs.

Dzhami-Jame-ALI commented 4 months ago

Yes, I changed the scheme to debug the process as root. If debugged as root, then system processes will appear after filter guard result != -1 else { return } .