如何获取Windows上cpu上的实际内核数? [英] How to get the number of actual cores on the cpu on windows?

查看:84
本文介绍了如何获取Windows上cpu上的实际内核数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道存在std :: thread :: hardware_concurrency(),但是它返回虚拟核心的数量.当针对内核的物理数量时,此算法可达到最佳效果(提高5-10%).如何在Windows上的C ++中获取该数字?

I know of the existence of std::thread::hardware_concurrency() but it returns the number of virtual cores. The algorithm this is for works at its best(5-10% better) when its targeting the physical number of cores. How could I get that number in c++ on windows?

推荐答案

The function referenced at this MSDN page is your friend here. The example on that page prints out the number of processor cores and the number of logical processor cores.

这篇关于如何获取Windows上cpu上的实际内核数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆