Exemplo n.º 1
0
    public static PERFORMANCE_ENUM GetPerformanceType()
    {
        int   height    = Screen.height;
        uint  cpuCount  = HWInfo.getCpuCoreNumber();
        long  ram       = long.Parse(PhoneInfo.getTotalMemory()) / 1024 / 1024;
        float frequency = (float)HWInfo.getCpuMaxFre() / 1024 / 1024;

        Log.info("height : " + height);
        Log.info("cpuCount : " + cpuCount);
        Log.info("ram : " + ram);
        Log.info("frequency : " + frequency);

        if (ram >= 2500)
        {
            // 大于3g全部为中
            return(PERFORMANCE_ENUM.MIDDLE);
        }
        else
        if (ram < 1600)
        {
            // 小于2G 全部为低
            return(PERFORMANCE_ENUM.LOW);
        }

        if (cpuCount > 4)
        {
            // 4核以上为中
            return(PERFORMANCE_ENUM.MIDDLE);
        }

        // 获取硬件信息
        string hardware = PhoneInfo.getHardware();

        Log.info("hardware : " + hardware);
        foreach (string member in lowCpuSet)
        {
            if (hardware.ToLower().StartsWith(member))
            {
                // 指定低端cpu的,全部为低
                return(PERFORMANCE_ENUM.LOW);
            }
        }

        // 其他为中
        return(PERFORMANCE_ENUM.MIDDLE);
    }