是否有任何的API,它讲述了一个Android设备是否为双核或不? [英] Is there any API that tells whether an Android device is dual-core or not?

查看:83
本文介绍了是否有任何的API,它讲述了一个Android设备是否为双核或不?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过做多线程双核心优化,它的工作原理是这样的: 如果设备具有双核处理器,将创建两个线程完成计算,并且如果装置只有一个核处理器,只有一个线程被创建做计算

I am doing dual core optimization by multi-threading, and it works like this: If the device has dual-core processor, two threads are created to do the computation, and if the device has only one-core processor, only one thread is created to do the computation.

我的问题是:怎么我的程序知道设备是否是双核还是不? 我只希望有一程序,它可以既双核和一核心设备上运行,因此它必须能够知道的信息。

My question is: how does my program know whether a device is dual-core or not? I just want to have one program that can run on both dual-core and one-core devices, so it has to be able to know that information.

code是这样的:

    if( xxx_API_is_device_dual_core() )  // Inside if() is the expected API
    {
     saveThread = new SaveThread[2];
    }
    else
    {
    saveThread = new SaveThread[1];
    }

非常感谢您的帮助!

Thank you very much for any help!

推荐答案

是的 Runtime.availableProcessors()未能在2核设备上正确地报告?

Is Runtime.availableProcessors() fails to report correctly on the 2-core device?

这篇关于是否有任何的API,它讲述了一个Android设备是否为双核或不?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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