pd4d10 / system-monitor

A browser extension to monitor system status like CPU and memory
https://chrome.google.com/webstore/detail/system-monitor/ecmlflnkenbdjfocclindonmigndecla
MIT License
81 stars 12 forks source link

CPU usage does not show the right data anymore since ChromeOS 74 #3

Closed Ariwari closed 4 years ago

Ariwari commented 5 years ago

CPU Usage is not showing the proper data anymore since Hyperthreading was disabled in ChromeOS 74.

It still shows all the 4 virtual cores, yet 2 of them are always at 99% usage.

Screenshot 2019-05-19 at 14 42 49

mrdoob commented 4 years ago

+1

pd4d10 commented 4 years ago

Hi, sorry for the late response.

I don't have a Chromebook, so I've tested it at a virtual machine (using CloudReady image) but could not reproduce this issue.

It is possibly caused by the API difference between Chromebook and Chrome on other devices. So I think we may need your help for debugging:

  1. Click the icon to open the popup
  2. Right-click on the popup, select Inspect to open the devtools window
  3. Select the console tab, paste the following code into it and run
    chrome.system.cpu.getInfo(info => {
    console.log(JSON.stringify(info))
    })

It would print the result of chrome.system.cpu.getInfo API, which is also used in this extension. pasting it here would help us in debugging.

pd4d10 commented 4 years ago

Also /cc @homayounshahri for #4

Ariwari commented 4 years ago

@pd4d10

chrome.system.cpu.getInfo(info => { console.log(JSON.stringify(info)) }) undefined VM16:2 {"archName":"x86_64","features":["mmx","sse","sse2","sse3","ssse3","sse4_1","sse4_2","avx"],"modelName":"Intel(R) Core(TM) m3-8100Y CPU @ 1.10GHz","numOfProcessors":4,"processors":[{"usage":{"idle":310949,"kernel":12096,"total":363672,"user":40627}},{"usage":{"idle":0,"kernel":0,"total":0,"user":0}},{"usage":{"idle":294052,"kernel":18073,"total":363880,"user":51755}},{"usage":{"idle":0,"kernel":0,"total":0,"user":0}}],"temperatures":[25]}[](url)

homayounshahri commented 4 years ago

chrome.system.cpu.getInfo(info => { console.log(JSON.stringify(info)) }) undefined VM197:2 {"archName":"x86_64","features":["mmx","sse","sse2","sse3","ssse3","sse4_1","sse4_2","avx"],"modelName":"Intel(R) Core(TM) i5-7Y57 CPU @ 1.20GHz","numOfProcessors":4,"processors":[{"usage":{"idle":82402,"kernel":8588,"total":131370,"user":40380}},{"usage":{"idle":0,"kernel":0,"total":0,"user":0}},{"usage":{"idle":21545,"kernel":10690,"total":75776,"user":43541}},{"usage":{"idle":0,"kernel":0,"total":0,"user":0}}],"temperatures":[33]}

If I did it correctly, I got the same answer as the previous commenter. It seems like the second and 4th processor show '0' for some reason! I wonder if there is another API that can correctly report the CPU usage. Or could it be an error on Google's side? Thanks.

Ariwari commented 4 years ago

chrome.system.cpu.getInfo(info => { console.log(JSON.stringify(info)) }) undefined VM197:2 {"archName":"x86_64","features":["mmx","sse","sse2","sse3","ssse3","sse4_1","sse4_2","avx"],"modelName":"Intel(R) Core(TM) i5-7Y57 CPU @ 1.20GHz","numOfProcessors":4,"processors":[{"usage":{"idle":82402,"kernel":8588,"total":131370,"user":40380}},{"usage":{"idle":0,"kernel":0,"total":0,"user":0}},{"usage":{"idle":21545,"kernel":10690,"total":75776,"user":43541}},{"usage":{"idle":0,"kernel":0,"total":0,"user":0}}],"temperatures":[33]}

If I did it correctly, I got the same answer as the previous commenter. It seems like the second and 4th processor show '0' for some reason! I wonder if there is another API that can correctly report the CPU usage. Or could it be an error on Google's side? Thanks.

I think the API 'is' correctly showing the CPU usage. ChromeOS is still getting the picture of a 4 core CPU (because of the hyperthreading), which is still true because I think hyperthreading is done on the (hardware) CPU level and not the (software) OS. It's ChromeOS that decides to not use 2 of the 4 cores. At least that's how I'd explain it.

homayounshahri commented 4 years ago

A bit more info. I just tried the COG (system info viewer) extension and that has exactly the same issue on pixel book!

homayounshahri commented 4 years ago

Also tried this extension: (Monitor and Clean system's CPU / RAM usage) and it has the same issue on Chromebook! Ariwari may be correct. This CPU has 2 cores and 4 threads. However, even in this case, the graph does not update correctly when displayed on the browser bar. It essentially shows zero. I wonder if google added another API that shows all threads as well!

homayounshahri commented 4 years ago

But the strange thing is that the same API does report the usage for all the threads on Chromebooks other than Pixel book!

Ariwari commented 4 years ago

But the strange thing is that the same API does report the usage for all the threads on Chromebooks other than Pixel book!

This could be due to the fact that your other Chromebooks might not have Intel CPU's. ARM CPU's do not have the (Intel) hyperthreading security issues and therefore not the mitigations (= disabling hyperthreading) that were introduced in ChromeOS 74.

homayounshahri commented 4 years ago

Here is how to solve the issue and Ariwaris is quite correct. https://www.reddit.com/r/chromeos/comments/celwhn/pixelbook_showing_only_2_cores_at_work_in_cog/ Everything is now working perfectly and the extension is showing all the cores after turning hyperthreading on again.

Ariwari commented 4 years ago

Here is how to solve the issue and Ariwaris is quite correct. https://www.reddit.com/r/chromeos/comments/celwhn/pixelbook_showing_only_2_cores_at_work_in_cog/ Everything is now working perfectly and the extension is showing all the cores after turning hyperthreading on again.

Do keep in mind that Google disabled hyperthreading with a reason, it might not be the best of an idea to 'just enable it again'. Chromebooks are becoming more popular every day; for both common users and criminals trying to exploit them.

I myself did not notice any real perfomance issue so I'm keeping it disabled.

homayounshahri commented 4 years ago

Yes, I read the vulnerabilities but still decided to turn it on. For my usage the performance degradation is significant. And thanks for the info.

pd4d10 commented 4 years ago

Thanks for your information!

As @homayounshahri says, it is because chrome's API returns 0, and we do not handle it correctly.

Perhaps we should hide the items without significant data.

pd4d10 commented 4 years ago

Hi, the latest v1.5.0 has been published to Chrome Web Store to fix this.

Feel free to reopen it if there is any problem.

homayounshahri commented 4 years ago

Thanks a lot!