当前位置: 首页> 文旅> 艺术 > 网页制作方案策划_上海人才招聘网官网_人大常委会委员长_爱站网权重查询

网页制作方案策划_上海人才招聘网官网_人大常委会委员长_爱站网权重查询

时间:2025/7/10 15:34:23来源:https://blog.csdn.net/jangdong/article/details/143632061 浏览次数:0次
网页制作方案策划_上海人才招聘网官网_人大常委会委员长_爱站网权重查询

一、chrome.system.cpu

使用 system.cpu API 查询 CPU 元数据。

权限

system.cpu

类型

CpuInfo

属性
  • archName

    字符串

    处理器的架构名称。

  • 功能

    字符串[]

    一组功能代码,用于表示处理器的部分功能。目前支持的代码包括“mmx”“sse”“sse2”“sse3”“ssse3”“sse4_1”“sse4_2”和“avx”。

  • modelName

    字符串

    处理器的型号名称。

  • numOfProcessors

    number

    逻辑处理器数量。

  • 处理器

    ProcessorInfo[]

    每个逻辑处理器的相关信息。

  • 温度

    数值 []

    Chrome 60 及更高版本

    来自 CPU 每个热区的 CPU 温度读数列表。温度以摄氏度为单位。

    目前仅适用于 ChromeOS。

CpuTime

属性
  • 空闲

    number

    此处理器的累计空闲时间。

  • 内核

    number

    此处理器上的内核程序使用的累计时间。

  • 总计

    number

    此处理器的总累计时间。此值等于用户 + 内核 + 空闲。

  • 用户

    number

    用户空间程序在此处理器上使用的累计时间。

ProcessorInfo

属性
  • 使用量

    CpuTime

    此逻辑处理器的累计使用信息。

方法

getInfo()

<ph type="x-smartling-placeholder"></ph> 承诺

chrome.system.cpu.getInfo(callback?: function,
)

查询系统的基本 CPU 信息。

参数
  • callback

    函数(可选)

    callback 参数如下所示:

    (info: CpuInfo) => void

chrome.system.cpu  |  API  |  Chrome for Developers

二、chrome.system.cpu 接口定义c++:

1、system_cpu.idl

extensions\common\api\system_cpu.idl

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.// Use the <code>system.cpu</code> API to query CPU metadata.
namespace system.cpu {// Counters for assessing CPU utilization.  Each field is monotonically// increasing while the processor is powered on.  Values are in milliseconds.dictionary CpuTime {// The cumulative time used by userspace programs on this processor.double user;// The cumulative time used by kernel programs on this processor.double kernel;// The cumulative time spent idle by this processor.double idle;// The total cumulative time for this processor.  This value is equal to// user + kernel + idle.double total;};dictionary ProcessorInfo {// Cumulative usage info for this logical processor.CpuTime usage;};dictionary CpuInfo {// The number of logical processors.long numOfProcessors;// The architecture name of the processors.DOMString archName;// The model name of the processors.DOMString modelName;// A set of feature codes indicating some of the processor's capabilities.// The currently supported codes are "mmx", "sse", "sse2", "sse3", "ssse3",// "sse4_1", "sse4_2", and "avx".DOMString[] features;// Information about each logical processor.ProcessorInfo[] processors;// List of CPU temperature readings from each thermal zone of the CPU.// Temperatures are in degrees Celsius.//// <b>Currently supported on Chrome OS only.</b>double[] temperatures;};callback CpuInfoCallback = void (CpuInfo info);interface Functions {// Queries basic CPU information of the system.[supportsPromises] static void getInfo(CpuInfoCallback callback);};
};

2、system_cpu.idl自动生成c++文件:

out\Debug\gen\extensions\common\api\system_cpu.h

out\Debug\gen\extensions\common\api\system_cpu.cc

3、chrome.system.cpu api定义c++:

extensions\browser\api\system_cpu\system_cpu_api.h

extensions\browser\api\system_cpu\system_cpu_api.cc

namespace extensions {class SystemCpuGetInfoFunction : public ExtensionFunction {public:DECLARE_EXTENSION_FUNCTION("system.cpu.getInfo", SYSTEM_CPU_GETINFO)SystemCpuGetInfoFunction() = default;SystemCpuGetInfoFunction(const SystemCpuGetInfoFunction&) = delete;SystemCpuGetInfoFunction& operator=(const SystemCpuGetInfoFunction&) = delete;private:~SystemCpuGetInfoFunction() override = default;// ExtensionFunction:ResponseAction Run() override;void OnGetCpuInfoCompleted(bool success);
};}  // namespace extensions

关键字:网页制作方案策划_上海人才招聘网官网_人大常委会委员长_爱站网权重查询

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: