导航:首页 > 操作系统 > androidcpuid

androidcpuid

发布时间:2022-10-23 14:40:27

Ⅰ 如何获取 android 设备的CPU核数,时钟频率以及内存大小

获取 CPU 核数 Linux 中的设备都是以文件的形式存在,CPU 也不例外,因此 CPU 的文件个数就等价与核数。 Android 的 CPU 设备文件位于/sys/devices/system/cpu/目录,文件名的的格式为cpu\d+。 root@generic_x86_64:/sys/devices/system/cpu # ls cpu0 cpufreq cpuidle kernel_max modalias offline online possible power present uevent 统计一下文件个数便可以获得 CPU 核数。 public static int getNumberOfCPUCores() { if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) { // Gingerbread doesn't support giving a single application access to both cores, but a // handful of devices (Atrix 4G and Droid X2 for example) were released with a al-core // chipset and Gingerbread; that can let an app in the background run without impacting // the foreground application. But for our purposes, it makes them single core. return 1; } int cores; try { cores = new File("/sys/devices/system/cpu/").listFiles(CPU_FILTER).length; } catch (SecurityException e) { cores = DEVICEINFO_UNKNOWN; } catch (NullPointerException e) { cores = DEVICEINFO_UNKNOWN; } return cores; } private static final FileFilter CPU_FILTER = new FileFilter() { @Override public boolean accept(File pathname) { String path = pathname.getName(); //regex is slow, so checking char by char. if (path.startsWith("cpu")) { for (int i = 3; i < path.length(); i++) { if (path.charAt(i) < '0' path.charAt(i) > '9') { return false; } } return true; } return false; } }; 获取时钟频率 获取时钟频率需要读取系统文件 -/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq或者/proc/cpuinfo。 Android 模拟器中并没有cpuinfo_max_freq文件,因此只能读取/proc/cpuinfo。 /proc/cpuinfo包含了很多 cpu 数据。 processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 70 model name : Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz stepping : 1 cpu MHz : 0.000 cache size : 1024 KB fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 4 wp : yes 代码如下: public static int getCPUMaxFreqKHz() { int maxFreq = DEVICEINFO_UNKNOWN; try { for (int i = 0; i < getNumberOfCPUCores(); i++) { String filename = "/sys/devices/system/cpu/cpu" + i + "/cpufreq/cpuinfo_max_freq"; File cpuInfoMaxFreqFile = new File(filename); if (cpuInfoMaxFreqFile.exists()) { byte[] buffer = new byte[128]; FileInputStream stream = new FileInputStream(cpuInfoMaxFreqFile); try { stream.read(buffer); int endIndex = 0; //Trim the first number out of the byte buffer. while (buffer[endIndex] >= '0' && buffer[endIndex] <= '9' && endIndex < buffer.length) endIndex++; String str = new String(buffer, 0, endIndex); Integer freqBound = Integer.parseInt(str); if (freqBound > maxFreq) maxFreq = freqBound; } catch (NumberFormatException e) { //Fall through and use /proc/cpuinfo. } finally { stream.close(); } } } if (maxFreq == DEVICEINFO_UNKNOWN) { FileInputStream stream = new FileInputStream("/proc/cpuinfo"); try { int freqBound = parseFileForValue("cpu MHz", stream); freqBound *= 1000; //MHz -> kHz if (freqBound > maxFreq) maxFreq = freqBound; } finally { stream.close(); } } } catch (IOException e) { maxFreq = DEVICEINFO_UNKNOWN; //Fall through and return unknown. } return maxFreq; } 获取内存大小 如果 SDK 版本大于等于JELLY_BEAN,可以通过ActivityManager来获取内从大小。 ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo(); ActivityManager am = (ActivityManager) c.getSystemService(Context.ACTIVITY_SERVICE); am.getMemoryInfo(memInfo); 如果版本低于JELLY_BEAN,则只能读取系统文件了。 FileInputStream stream = new FileInputStream("/proc/meminfo"); totalMem = parseFileForValue("MemTotal", stream); 完整代码如下: @TargetApi(Build.VERSION_CODES.JELLY_BEAN) public static long getTotalMemory(Context c) { // memInfo.totalMem not supported in pre-Jelly Bean APIs. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo(); ActivityManager am = (ActivityManager) c.getSystemService(Context.ACTIVITY_SERVICE); am.getMemoryInfo(memInfo); if (memInfo != null) { return memInfo.totalMem; } else { return DEVICEINFO_UNKNOWN; } } else { long totalMem = DEVICEINFO_UNKNOWN; try { FileInputStream stream = new FileInputStream("/proc/meminfo"); try { totalMem = parseFileForValue("MemTotal", stream); totalMem *= 1024; } finally { stream.close(); } } catch (IOException e) { } return totalMem; } }

Ⅱ android可以获取cpuid吗

可以,直接下载个安兔兔,再看设备信息即可看到

Ⅲ 如何获取 Android 设备的CPU核数,时钟频率以及内存大小

Device Year Class 的主要功能是根据 CPU核数、时钟频率 以及 内存大小 对设备进行分级。代码很简单,只包含两个类:
DeviceInfo-> 获取设备参数,
YearClass-> 根据参数进行分级。
下表是 Facebook 公司提供的分级标准,其中Year栏表示分级结果。

Year
Cores
Clock
RAM

2008 1 528MHz 192MB
2009 n/a 600MHz 290MB
2010 n/a 1.0GHz 512MB
2011 2 1.2GHz 1GB
2012 4 1.5GHz 1.5GB
2013 n/a 2.0GHz 2GB
2014 n/a >2GHz >2GB
关于输出年份的计算方法可以参考源码,本文只把一些比较常用的功能抽取出来做一个简要介绍。
获取 CPU 核数
我们都知道,Linux 中的设备都是以文件的形式存在,CPU 也不例外,因此 CPU 的文件个数就等价与核数。
Android 的 CPU 设备文件位于/sys/devices/system/cpu/目录,文件名的的格式为cpu\d+。

root@generic_x86_64:/sys/devices/system/cpu # ls <b>cpu0</b> cpufreq
cpuidle
kernel_max
modalias
offline
online
possible
power
present
uevent

统计一下文件个数便可以获得 CPU 核数。

public static int getNumberOfCPUCores() {
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) {
// Gingerbread doesn't support giving a single application access to both cores, but a
// handful of devices (Atrix 4G and Droid X2 for example) were released with a al-core
// chipset and Gingerbread; that can let an app in the background run without impacting
// the foreground application. But for our purposes, it makes them single core.
return 1;
}
int cores;
try {
cores = new File("/sys/devices/system/cpu/").listFiles(CPU_FILTER).length;
} catch (SecurityException e) {
cores = DEVICEINFO_UNKNOWN;
} catch (NullPointerException e) {
cores = DEVICEINFO_UNKNOWN;
}
return cores;
}

private static final FileFilter CPU_FILTER = new FileFilter() {
@Override
public boolean accept(File pathname) {
String path = pathname.getName();
//regex is slow, so checking char by char.
if (path.startsWith("cpu")) {
for (int i = 3; i < path.length(); i++) {
if (path.charAt(i) < '0' || path.charAt(i) > '9') {
return false;
}
}
return true;
}
return false;
}
};

获取时钟频率
获取时钟频率需要读取系统文件 -/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq或者/proc/cpuinfo。
我的 Android 模拟器中并没有cpuinfo_max_freq文件,因此只能读取/proc/cpuinfo。
/proc/cpuinfo包含了很多 cpu 数据。

processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 70
model name : Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
stepping : 1
cpu MHz : 0.000
cache size : 1024 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 4
wp : yes

代码如下:

public static int getCPUMaxFreqKHz() {
int maxFreq = DEVICEINFO_UNKNOWN;
try {
for (int i = 0; i < getNumberOfCPUCores(); i++) {
String filename =
"/sys/devices/system/cpu/cpu" + i + "/cpufreq/cpuinfo_max_freq";
File cpuInfoMaxFreqFile = new File(filename);
if (cpuInfoMaxFreqFile.exists()) {
byte[] buffer = new byte[128];
FileInputStream stream = new FileInputStream(cpuInfoMaxFreqFile);
try {
stream.read(buffer);
int endIndex = 0;
//Trim the first number out of the byte buffer.
while (buffer[endIndex] >= '0' && buffer[endIndex] <= '9'
&& endIndex < buffer.length) endIndex++;
String str = new String(buffer, 0, endIndex);
Integer freqBound = Integer.parseInt(str);
if (freqBound > maxFreq) maxFreq = freqBound;
} catch (NumberFormatException e) {
//Fall through and use /proc/cpuinfo.
} finally {
stream.close();
}
}
}
if (maxFreq == DEVICEINFO_UNKNOWN) {
FileInputStream stream = new FileInputStream("/proc/cpuinfo");
try {
int freqBound = parseFileForValue("cpu MHz", stream);
freqBound *= 1000; //MHz -> kHz
if (freqBound > maxFreq) maxFreq = freqBound;
} finally {
stream.close();
}
}
} catch (IOException e) {
maxFreq = DEVICEINFO_UNKNOWN; //Fall through and return unknown.
}
return maxFreq;
}

获取内存大小
如果 SDK 版本大于等于JELLY_BEAN,可以通过ActivityManager来获取内从大小。

ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo();
ActivityManager am = (ActivityManager) c.getSystemService(Context.ACTIVITY_SERVICE);
am.getMemoryInfo(memInfo);

如果版本低于JELLY_BEAN,则只能读取系统文件了。

FileInputStream stream = new FileInputStream("/proc/meminfo");
totalMem = parseFileForValue("MemTotal", stream);

Ⅳ 如何获取 Android 设备的CPU核数,时钟频率以及内存大小

获取 CPU 核数
Linux 中的设备都是以文件的形式存在,CPU 也不例外,因此 CPU 的文件个数就等价与核数。
Android 的 CPU 设备文件位于/sys/devices/system/cpu/目录,文件名的的格式为cpu\d+。
root@generic_x86_64:/sys/devices/system/cpu # ls cpu0 cpufreq
cpuidle
kernel_max
modalias
offline
online
possible
power
present
uevent

统计一下文件个数便可以获得 CPU 核数。
public static int getNumberOfCPUCores() {
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) {
// Gingerbread doesn't support giving a single application access to both cores, but a
// handful of devices (Atrix 4G and Droid X2 for example) were released with a al-core
// chipset and Gingerbread; that can let an app in the background run without impacting
// the foreground application. But for our purposes, it makes them single core.
return 1;
}
int cores;
try {
cores = new File("/sys/devices/system/cpu/").listFiles(CPU_FILTER).length;
} catch (SecurityException e) {
cores = DEVICEINFO_UNKNOWN;
} catch (NullPointerException e) {
cores = DEVICEINFO_UNKNOWN;
}
return cores;
}

private static final FileFilter CPU_FILTER = new FileFilter() {
@Override
public boolean accept(File pathname) {
String path = pathname.getName();
//regex is slow, so checking char by char.
if (path.startsWith("cpu")) {
for (int i = 3; i < path.length(); i++) {
if (path.charAt(i) < '0' || path.charAt(i) > '9') {
return false;
}
}
return true;
}
return false;
}
};

获取时钟频率
获取时钟频率需要读取系统文件 -/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq或者/proc/cpuinfo。
Android 模拟器中并没有cpuinfo_max_freq文件,因此只能读取/proc/cpuinfo。
/proc/cpuinfo包含了很多 cpu 数据。
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 70
model name : Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
stepping : 1
cpu MHz : 0.000
cache size : 1024 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 4
wp : yes

代码如下:
public static int getCPUMaxFreqKHz() {
int maxFreq = DEVICEINFO_UNKNOWN;
try {
for (int i = 0; i < getNumberOfCPUCores(); i++) {
String filename =
"/sys/devices/system/cpu/cpu" + i + "/cpufreq/cpuinfo_max_freq";
File cpuInfoMaxFreqFile = new File(filename);
if (cpuInfoMaxFreqFile.exists()) {
byte[] buffer = new byte[128];
FileInputStream stream = new FileInputStream(cpuInfoMaxFreqFile);
try {
stream.read(buffer);
int endIndex = 0;
//Trim the first number out of the byte buffer.
while (buffer[endIndex] >= '0' && buffer[endIndex] <= '9'
&& endIndex < buffer.length) endIndex++;
String str = new String(buffer, 0, endIndex);
Integer freqBound = Integer.parseInt(str);
if (freqBound > maxFreq) maxFreq = freqBound;
} catch (NumberFormatException e) {
//Fall through and use /proc/cpuinfo.
} finally {
stream.close();
}
}
}
if (maxFreq == DEVICEINFO_UNKNOWN) {
FileInputStream stream = new FileInputStream("/proc/cpuinfo");
try {
int freqBound = parseFileForValue("cpu MHz", stream);
freqBound *= 1000; //MHz -> kHz
if (freqBound > maxFreq) maxFreq = freqBound;
} finally {
stream.close();
}
}
} catch (IOException e) {
maxFreq = DEVICEINFO_UNKNOWN; //Fall through and return unknown.
}
return maxFreq;
}

获取内存大小
如果 SDK 版本大于等于JELLY_BEAN,可以通过ActivityManager来获取内从大小。
ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo();
ActivityManager am = (ActivityManager) c.getSystemService(Context.ACTIVITY_SERVICE);
am.getMemoryInfo(memInfo);

如果版本低于JELLY_BEAN,则只能读取系统文件了。
FileInputStream stream = new FileInputStream("/proc/meminfo");
totalMem = parseFileForValue("MemTotal", stream);

完整代码如下:
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public static long getTotalMemory(Context c) {
// memInfo.totalMem not supported in pre-Jelly Bean APIs.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo();
ActivityManager am = (ActivityManager) c.getSystemService(Context.ACTIVITY_SERVICE);
am.getMemoryInfo(memInfo);
if (memInfo != null) {
return memInfo.totalMem;
} else {
return DEVICEINFO_UNKNOWN;
}
} else {
long totalMem = DEVICEINFO_UNKNOWN;
try {
FileInputStream stream = new FileInputStream("/proc/meminfo");
try {
totalMem = parseFileForValue("MemTotal", stream);
totalMem *= 1024;
} finally {
stream.close();
}
} catch (IOException e) {
}
return totalMem;
}
}

Ⅳ 死亡扳机2怎么刷金币

板机2僵尸太厉害了 赚钱难~不过有张图很好刷钱 现在技术升到4级了杀僵尸得2块,砍手砍头奖励7块呢!僵尸还随机掉钱40块, 非洲室外地图有个运4箱子的很好拿刀刷钱,主要是交3个箱子,第四个不交找个地方拿刀砍怪,可能游戏问题第四箱子拿到手不交任务就不刷小boss了,全小僵尸,拿刀特好刷钱,我刷的简单级别,2刀一只怪,掉落和困难一样,可以挂机刷,不过要小心拿棍子的僵尸,距离比刀远,第一时间杀。我一般带20红瓶,刷一万就闪~怕死机

Ⅵ 如何获取 Android 设备的CPU核数,时钟频率以及内存大小

获取 CPU 核数
Linux 中的设备都是以文件的形式存在,CPU 也不例外,因此 CPU 的文件个数就等价与核数。
Android 的 CPU 设备文件位于/sys/devices/system/cpu/目录,文件名的的格式为cpu\d+。
root@generic_x86_64:/sys/devices/system/cpu # ls cpu0 cpufreq
cpuidle
kernel_max
modalias
offline
online
possible
power
present
uevent
统计一下文件个数便可以获得 CPU 核数。
public static int getNumberOfCPUCores() {
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) {
// Gingerbread doesn't support giving a single application access to both cores, but a
// handful of devices (Atrix 4G and Droid X2 for example) were released with a al-core
// chipset and Gingerbread; that can let an app in the background run without impacting
// the foreground application. But for our purposes, it makes them single core.
return 1;
}
int cores;
try {
cores = new File(“/sys/devices/system/cpu/”)。listFiles(CPU_FILTER)。length;
} catch (SecurityException e) {
cores = DEVICEINFO_UNKNOWN;
} catch (NullPointerException e) {
cores = DEVICEINFO_UNKNOWN;
}
return cores;
}
private static final FileFilter CPU_FILTER = new FileFilter() {
@Override
public boolean accept(File pathname) {
String path = pathname.getName();
//regex is slow, so checking char by char.
if (path.startsWith(“cpu”)) {
for (int i = 3; i < path.length(); i++) {
if (path.charAt(i) < '0' path.charAt(i) > '9‘) {
return false;
}
}
return true;
}
return false;
}
};
获取时钟频率
获取时钟频率需要读取系统文件 -/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq或者/proc/cpuinfo。
Android 模拟器中并没有cpuinfo_max_freq文件,因此只能读取/proc/cpuinfo。
/proc/cpuinfo包含了很多 cpu 数据。
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 70
model name : Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
stepping : 1
cpu MHz : 0.000
cache size : 1024 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 4
wp : yes
代码如下:
public static int getCPUMaxFreqKHz() {
int maxFreq = DEVICEINFO_UNKNOWN;
try {
for (int i = 0; i < getNumberOfCPUCores(); i++) {
String filename =
“/sys/devices/system/cpu/cpu” + i + “/cpufreq/cpuinfo_max_freq”;
File cpuInfoMaxFreqFile = new File(filename);
if (cpuInfoMaxFreqFile.exists()) {
byte[] buffer = new byte[128];
FileInputStream stream = new FileInputStream(cpuInfoMaxFreqFile);
try {
stream.read(buffer);
int endIndex = 0;
//Trim the first number out of the byte buffer.
while (buffer[endIndex] >= '0' && buffer[endIndex] <= '9'
&& endIndex < buffer.length) endIndex++;
String str = new String(buffer, 0, endIndex);
Integer freqBound = Integer.parseInt(str);
if (freqBound > maxFreq) maxFreq = freqBound;
} catch (NumberFormatException e) {
//Fall through and use /proc/cpuinfo.
} finally {
stream.close();
}
}
}
if (maxFreq == DEVICEINFO_UNKNOWN) {
FileInputStream stream = new FileInputStream(“/proc/cpuinfo”);
try {
int freqBound = parseFileForValue(“cpu MHz”, stream);
freqBound *= 1000; //MHz -> kHz
if (freqBound > maxFreq) maxFreq = freqBound;
} finally {
stream.close();
}
}
} catch (IOException e) {
maxFreq = DEVICEINFO_UNKNOWN; //Fall through and return unknown.
}
return maxFreq;
}
获取内存大小
如果 SDK 版本大于等于JELLY_BEAN,可以通过ActivityManager来获取内从大小。
ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo();
ActivityManager am = (ActivityManager) c.getSystemService(Context.ACTIVITY_SERVICE);
am.getMemoryInfo(memInfo);
如果版本低于JELLY_BEAN,则只能读取系统文件了。
FileInputStream stream = new FileInputStream(“/proc/meminfo”);
totalMem = parseFileForValue(“MemTotal”, stream);
完整代码如下:
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public static long getTotalMemory(Context c) {
// memInfo.totalMem not supported in pre-Jelly Bean APIs.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo();
ActivityManager am = (ActivityManager) c.getSystemService(Context.ACTIVITY_SERVICE);
am.getMemoryInfo(memInfo);
if (memInfo != null) {
return memInfo.totalMem;
} else {
return DEVICEINFO_UNKNOWN;
}
} else {
long totalMem = DEVICEINFO_UNKNOWN;
try {
FileInputStream stream = new FileInputStream(“/proc/meminfo”);
try {
totalMem = parseFileForValue(“MemTotal”, stream);
totalMem *= 1024;
} finally {
stream.close();
}
} catch (IOException e) {
}
return totalMem;
}
}

Ⅶ 华为笔记本bobwah9是I5几代

“Intel推出了代号为Coffeelake的酷睿8代了,听说性能涨了一大截!我是不是该升级了呢?”每当被问到这个问题,我就会反问朋友的电脑配置,令我惊讶的是很多人都不知道怎么看自己的CPU是什么型号,更对自己型号意味着第几代酷睿没有概念。那么如何得到这些信息呢?
CPU型号那里找?
很简单,用Win + E打开Windows Explorer,右键点击“这台电脑”,在弹出的菜单里面选择“属性”。
在随后的“系统属性”窗口中我们就可以看到CPU的信息了:
CPU信息意味着什么?
那么这个Core(TM) i5-5300U是什么意思呢?Core就是酷睿,i5就是酷睿i3、i5、i7和i9中的i5,当然不属于极品i9,但也算对得起社会了。到底是i5的第几代呢?秘密就在后面的5300U上。Intel官网有详细的介绍:Intel® Processor Numbers: Laptop, Desktop, and Mobile Device
这里简单介绍一下
第一个字母是几就是几代,5300U就是酷睿第五代,U则代表超低功耗:
代号Coffeelake的最新第8代酷睿的编号意思也差不多:
对更老的型号、奔腾、赛扬和志强系列等感兴趣的同学可以自行查看原文。
酷睿n代和代码的关系
有同学会问酷睿n代和芯片架构代码(codename)的关系,怎么知道某一代叫什么名字,这样出去吹牛也可以装扮一下内行。Intel习惯于以美国地名命做codename,这和AMD玄妙的命名方式不同,也没有Android那么萌。CPU芯片架构的命名很有规律,那就是如果Core架构变化不大,则codename的地点类型不变,例如Well井系列:Haswell, Broardwell就是一个例子,前面是Bridge桥系列,下来就是悠长的Lake湖系列,Skylake, Kabylake和Coffelake。这也是Intel有名的Tick, Tock节奏带来的命名规则。
那么第一代是什么呢?i3、i5和i7第一代起源于传奇的Nehalem架构,在他的继任者Westmere出现后,这种tick-tock的战略还不稳定,命名规则也没有确定下来,导致他们都是酷睿一代。
CPU型号信息哪里来的?
作为一个BIOS和UEFI专栏,大家也许猜到了,这个信息是BIOS提供的。BIOS通过SMBIOS表告诉了OS这个信息,OS才能在系统信息里面显示出来。那么BIOS又是从哪里得到这个信息呢,是根据CPU型号自己组合出来的吗?
答案是否定的。这个信息叫做Processor Brand String,BIOS是通过CPUID指令得到的,我们在EAX其中依次填入0x8000002,0x8000003和0x8000004,分别执行三次CPUID命令,即可以在返回值里面读出准确的CPU brand name。这个过程在IA32的"圣经"三卷里面有详细的记载:

Ⅷ 最终幻想大师如何刷初始首抽

【快速首刷】FINAL FANTASY GRANDMASTERS
【不需root】
【删除档案】
/sdcard/Android/data/com.square_enix.android_googleplay.ffgm/files/cpuid.bin
【流程推荐】: 进行到职业任务时将各职业任务第一关完成共2000石可四抽,最近有维修奖励可在一抽。
【首抽推荐】: 看板武器都十分推荐、s防具也推
【首抽难度】:★★★★✩
【备注】: 推荐仅供参考,等待勇者们的攻略。
IOS首刷教学攻略:首先IOS设备需要JB,Document资料夹内的cpuid.bin删除。

Ⅸ 如何获取 Android 设备的CPU核数,时钟频率以及内存大小

Device Year Class 的主要功能是根据 CPU核数、时钟频率 以及 内存大小 对设备进行分级。代码很简单,只包含两个类: DeviceInfo-> 获取设备参数, YearClass-> 根据参数进行分级。 下表是 Facebook 公司提供的分级标准,其中Year栏表示分级结果。 Year Cores Clock RAM 2008 1 528MHz 192MB 2009 n/a 600MHz 290MB 2010 n/a 1.0GHz 512MB 2011 2 1.2GHz 1GB 2012 4 1.5GHz 1.5GB 2013 n/a 2.0GHz 2GB 2014 n/a >2GHz >2GB 关于输出年份的计算方法可以参考源码,本文只把一些比较常用的功能抽取出来做一个简要介绍。 获取 CPU 核数 我们都知道,Linux 中的设备都是以文件的形式存在,CPU 也不例外,因此 CPU 的文件个数就等价与核数。 Android 的 CPU 设备文件位于/sys/devices/system/cpu/目录,文件名的的格式为cpu\d+。 ? 1 2 3 4 5 6 7 8 9 10 root@generic_x86_64:/sys/devices/system/cpu # ls <b>cpu0</b> cpufreq cpuidle kernel_max modalias offline online possible power present uevent 统计一下文件个数便可以获得 CPU 核数。 ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 public static int getNumberOfCPUCores() { if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) { // Gingerbread doesn't support giving a single application access to both cores, but a // handful of devices (Atrix 4G and Droid X2 for example) were released with a al-core // chipset and Gingerbread; that can let an app in the background run without impacting // the foreground application. But for our purposes, it makes them single core. return 1; } int cores; try { cores = new File("/sys/devices/system/cpu/").listFiles(CPU_FILTER).length; } catch (SecurityException e) { cores = DEVICEINFO_UNKNOWN; } catch (NullPointerException e) { cores = DEVICEINFO_UNKNOWN; } return cores; } private static final FileFilter CPU_FILTER = new FileFilter() { @Override public boolean accept(File pathname) { String path = pathname.getName(); //regex is slow, so checking char by char. if (path.startsWith("cpu")) { for (int i = 3; i < path.length(); i++) { if (path.charAt(i) < '0' path.charAt(i) > '9') { return false; } } return true; } return false; } }; 回到顶部 获取时钟频率 获取时钟频率需要读取系统文件 -/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq或者/proc/cpuinfo。 我的 Android 模拟器中并没有cpuinfo_max_freq文件,因此只能读取/proc/cpuinfo。 /proc/cpuinfo包含了很多 cpu 数据。 ? processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 70 model name : Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz stepping : 1 cpu MHz : 0.000 cache size : 1024 KB fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 4 wp : yes 代码如下: public static int getCPUMaxFreqKHz() { int maxFreq = DEVICEINFO_UNKNOWN; try { for (int i = 0; i < getNumberOfCPUCores(); i++) { String filename = "/sys/devices/system/cpu/cpu" + i + "/cpufreq/cpuinfo_max_freq"; File cpuInfoMaxFreqFile = new File(filename); if (cpuInfoMaxFreqFile.exists()) { byte[] buffer = new byte[128]; FileInputStream stream = new FileInputStream(cpuInfoMaxFreqFile); try { stream.read(buffer); int endIndex = 0; //Trim the first number out of the byte buffer. while (buffer[endIndex] >= '0' && buffer[endIndex] <= '9' && endIndex < buffer.length) endIndex++; String str = new String(buffer, 0, endIndex); Integer freqBound = Integer.parseInt(str); if (freqBound > maxFreq) maxFreq = freqBound; } catch (NumberFormatException e) { //Fall through and use /proc/cpuinfo. } finally { stream.close(); } } } if (maxFreq == DEVICEINFO_UNKNOWN) { FileInputStream stream = new FileInputStream("/proc/cpuinfo"); try { int freqBound = parseFileForValue("cpu MHz", stream); freqBound *= 1000; //MHz -> kHz if (freqBound > maxFreq) maxFreq = freqBound; } finally { stream.close(); } } } catch (IOException e) { maxFreq = DEVICEINFO_UNKNOWN; //Fall through and return unknown. } return maxFreq; } 回到顶部 获取内存大小 如果 SDK 版本大于等于JELLY_BEAN,可以通过ActivityManager来获取内从大小。 ? ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo(); ActivityManager am = (ActivityManager) c.getSystemService(Context.ACTIVITY_SERVICE); am.getMemoryInfo(memInfo); 如果版本低于JELLY_BEAN,则只能读取系统文件了。 ? FileInputStream stream = new FileInputStream("/proc/meminfo"); totalMem = parseFileForValue("MemTotal", stream); 完整代码如下: @TargetApi(Build.VERSION_CODES.JELLY_BEAN) public static long getTotalMemory(Context c) { // memInfo.totalMem not supported in pre-Jelly Bean APIs. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo(); ActivityManager am = (ActivityManager) c.getSystemService(Context.ACTIVITY_SERVICE); am.getMemoryInfo(memInfo); if (memInfo != null) { return memInfo.totalMem; } else { return DEVICEINFO_UNKNOWN; } } else { long totalMem = DEVICEINFO_UNKNOWN; try { FileInputStream stream = new FileInputStream("/proc/meminfo"); try { totalMem = parseFileForValue("MemTotal", stream); totalMem *= 1024; } finally { stream.close(); } } catch (IOException e) { } return totalMem; } }

阅读全文

与androidcpuid相关的资料

热点内容
手机电音app哪个好 浏览:747
checksum命令 浏览:637
java创建xml文件 浏览:170
算命源码国际版 浏览:283
三菱模块化编程 浏览:718
控件读取文件源码 浏览:445
文件夹侧面目录标签怎么制作 浏览:232
做程序员学什么 浏览:320
pdfeditor教程 浏览:880
fortran把文件放入文件夹 浏览:709
程序员1年经验不敢投简历 浏览:481
如何看电脑的源码 浏览:897
找工作app软件哪个好 浏览:96
信息管理网站源码 浏览:439
小说app哪个好免费 浏览:224
域名在线加密 浏览:146
软件编程西安交大 浏览:453
是不是串货的奶粉查不到溯源码的 浏览:825
北京dns服务器云主机 浏览:221
openldaplinux安装 浏览:23