简体   繁体   English

Google Meet 如何显示 CPU 使用率?

[英]How is Google Meet able to show CPU usage?

I noticed this today in my Chrome.我今天在我的 Chrome 中注意到了这一点。

Google Meet CPU 使用率图表

Google Meet is showing a chart of CPU usage in their "Troubleshooting" panel. Google Meet 在其“疑难解答”面板中显示了 CPU 使用率图表。 I'm wondering if there's an existing API for this or is it a clever trick I'm not aware of.我想知道是否有一个现有的 API 或者这是一个我不知道的聪明技巧。

I was curious about this as well when I saw the CPU USage graph on the Troubleshooting page on the Google Meet's page.当我在 Google Meet 页面的故障排除页面上看到 CPU 使用率图表时,我也对此感到好奇。 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 .所以谷歌搜索了很多,除了这个链接之外,我找不到任何关于它是如何实现的正确答案: 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).所以,我浏览了 Google Meet 网站的缩小源代码,结果发现 Google Meet 正在使用它,但没有直接在他们的网页上使用,因为它仅适用于 chrome 扩展程序,而是通过 Chrome 中存在的Google Hangouts Extension , Brave 和新的 Microsoft Edge(基于 Chromium)。

在此处输入图片说明

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. Chrome 扩展程序调用chrome.system.cpu API 来获取有关处理器、核心数、温度等的信息,这些详细信息通过window.postMessage API 和 Chrome 扩展程序之间的消息传递传递到 Google Meets 页面和一个网页。

This is a neat little way to achieve this if you are the creator of the browser :P.如果您是浏览器的创建者,这是实现此目的的一个巧妙的小方法:P。

Most probably, they are using Chrome specific API since this will not work on other browsers.最有可能的是,他们使用的是 Chrome 特定的 API,因为这在其他浏览器上不起作用。 The closest thing that I've found is https://developer.chrome.com/extensions/system_cpu#method-getInfo我发现的最接近的是https://developer.chrome.com/extensions/system_cpu#method-getInfo

Below is a screenshot from Firefox stating that this will work only on Chrome.下面是来自 Firefox 的屏幕截图,说明这仅适用于 Chrome。

来自 Firefox 的快照

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM