最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How is Google Meet able to show CPU usage? - Stack Overflow

programmeradmin5浏览0评论

I noticed this today in my Chrome.

Google Meet is showing a chart of CPU usage in their "Troubleshooting" panel. I'm wondering if there's an existing API for this or is it a clever trick I'm not aware of.

I noticed this today in my Chrome.

Google Meet is showing a chart of CPU usage in their "Troubleshooting" panel. I'm wondering if there's an existing API for this or is it a clever trick I'm not aware of.

Share Improve this question asked Oct 20, 2020 at 10:02 Paweł BadeńskiPaweł Badeński 4095 silver badges12 bronze badges 1
  • Related: stackoverflow.com/questions/63658198/… – Kartik Soneji Commented Jun 26, 2021 at 19:49
Add a comment  | 

3 Answers 3

Reset to default 15

I was curious about this as well when I saw the CPU Usage graph on the Troubleshooting page on the Google Meet's page. So googled a lot and I couldn't find any proper answer as to how it is being achieved apart from this link: https://developer.chrome.com/extensions/system_cpu#method-getInfo.

So, I went through the minified source code of the Google Meet's site and it turns out Google Meet is using this but not on their webpage directly, because it is for chrome extensions only, but through the Google Hangouts Extension which is present in Chrome, Brave and the new Microsoft Edge (Chromium-based).

The chrome extension is calling the chrome.system.cpu API to get the information about the processor, core count, temperatures, etc., and these details are being passed to the Google Meets page via window.postMessage API and Message Passing between Chrome Extension and a Webpage.

This is a neat little way to achieve this if you are the creator of the browser :P.

Most probably, they are using Chrome specific API since this will not work on other browsers. The closest thing that I've found is https://developer.chrome.com/extensions/system_cpu#method-getInfo

Below is a screenshot from Firefox stating that this will work only on Chrome.

More details can be found here: https://news.ycombinator.com/item?id=40918052

Basically it's an old google extension, enabled by default on google chrome, edge and brave and only available on *.google.com urls.

Extension's source code can be found here: https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/resources/hangout_services/thunk.js

Paste this on any *.google.com site using google chrome, edge or brave:

chrome.runtime.sendMessage(
    'nkeimhogjdpnpccoofpliimaahmaaome', {
        method: 'cpu.getInfo'
    }, response => {
        console.log('CPU Info:\n', JSON.stringify(response, null, 2));
    }
);
发布评论

评论列表(0)

  1. 暂无评论