获取CPU信息
1 查看手机CPU信息
cmd——adb shell——cd /proc------cat cpuinfo
2 获取cpu的是arm指令集,armv7指令集、还是neon指令集
- /**
- *
- * [获取cpu类型和架构]
- *
- * @return
- * 三个参数类型的数组,第一个参数标识是不是ARM架构,第二个参数标识是V6还是V7架构,第三个参数标识是不是neon指令集
- */
- public static Object[] getCpuArchitecture() {
- if ((Integer) mArmArchitecture[1] != -1) {
- return mArmArchitecture;
- }
- try {
- InputStream is = new FileInputStream("/proc/cpuinfo");
- InputStreamReader ir = new InputStreamReader(is);
- BufferedReader br = new BufferedReader(ir);
- try {
- String nameProcessor = "Processor";
- String nameFeatures = "Features";
- String nameModel = "model name";
- String nameCpuFamily = "cpu family";
- while (true) {
- String line = br.readLine();
- String[] pair = null;
- if (line == null) {
- break;
- }
- pair = line.split(":");
- if (pair.length != 2)
- continue;
- String key = pair[0].trim();
- String val = pair[1].trim();
- if (key.compareTo(nameProcessor) == 0) {
- String n = "";
- for (int i = val.indexOf("ARMv") + 4; i < val.length(); i++) {
- String temp = val.charAt(i) + "";
- if (temp.matches("\\d")) {
- n += temp;
- } else {
- break;
- }
- }
- mArmArchitecture[0] = "ARM";
- mArmArchitecture[1] = Integer.parseInt(n);
- continue;
- }
- if (key.compareToIgnoreCase(nameFeatures) == 0) {
- if (val.contains("neon")) {
- mArmArchitecture[2] = "neon";
- }
- continue;
- }
- if (key.compareToIgnoreCase(nameModel) == 0) {
- if (val.contains("Intel")) {
- mArmArchitecture[0] = "INTEL";
- mArmArchitecture[2] = "atom";
- }
- continue;
- }
- if (key.compareToIgnoreCase(nameCpuFamily) == 0) {
- mArmArchitecture[1] = Integer.parseInt(val);
- continue;
- }
- }
- } finally {
- br.close();
- ir.close();
- is.close();
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- return mArmArchitecture;
- }
获取CPU信息的更多相关文章
- CPU测试--通过proc获取CPU信息
adb shell cat /proc/stat | grep cpu > totalcpu0 此处第一行的数值表示的是CPU总的使用情况,所以我们只要用第一行的数字计算就可以了.下表解析第一行 ...
- [Mac] 获取cpu信息
[Mac] 获取cpu信息 命令行获取cpu信息 sysctl machdep.cpu output like machdep.cpu.tsc_ccc.denominator: 0 machdep.c ...
- C++ 嵌入汇编 获取CPU信息
#include "windows.h" #include "iostream" #include "string" using names ...
- c++获取cpu信息
原文地址:http://blog.csdn.net/jamesliulyc/article/details/2028958 1.什么是cpuid指令 CPUID指令是intel IA32架构下获得CP ...
- CMD一键获取cpu信息
windows + R 输入cmd打开CMD 输入wmic cpu get Name 获取cpu名称-即物理cpu数 cpu get NumberOfCores获取cpu核心数 cpu get Num ...
- 汇编实现获取CPU信息
这是文章最后一次更新,加入了TLB与Cache信息等资料前言:论坛上面有人不明白CPUID指令的用法,于是就萌生写这篇文章的想法,若有错误话请大侠指出,谢谢了 ^^论坛的式样貌似有问题,若式样问题导致 ...
- 使用C#在Windows应用商店程序中获取CPU信息
using Windows.Devices.Enumeration; string guidStr="{97FADB10-4E33-40AE-359C-8BEF029DBDD0}" ...
- Python 脚本之获取CPU信息
#!/usr/bin/env Python from __future__ import print_function from collections import OrderedDict impo ...
- python3监控系统资源最终版(获取CPU,内存,磁盘,网卡等信息),返回json格式。
#!/usr/bin/env python3 #-*- coding:utf-8 -*- #create at 2018-12-07 'this is a system monitor scripts ...
随机推荐
- SQLBackupAndFTP The server principal "NT AUTHORITY\SYSTEM" is not able to access the database "xxxx"
Windows server 2012中使用SQLBackupAndFTP备份数据库时遇到一个错误: ERROR: The server principal "NT AUTHORITY\SY ...
- 在cmd和terminal怎么粘贴?
在osx, linux的terminal 以及windows的 cmd实现粘贴是coder经常要做的事,鼠标右键,下拉菜单中单击粘贴paste.但是这显得笨拙,及其不快捷.但是正常使用的command ...
- COGS 265线段覆盖[线段树]
265. 线段覆盖 ★★☆ 输入文件:xdfg.in 输出文件:xdfg.out 简单对比时间限制:2 s 内存限制:20 MB [问题描述] 有一根长度为 L 的白色条状物.有两种操 ...
- Oracle 增删改查
Oracle入门案例: 1.创建实体类Student 并重写ToString方法 package cn.happy.entity; public class Student { public Inte ...
- 第19章 集合框架(3)-Map接口
第19章 集合框架(3)-Map接口 1.Map接口概述 Map是一种映射关系,那么什么是映射关系呢? 映射的数学解释 设A,B是两个非空集合,如果存在一个法则,使得对A中的每一个元素a,按法则f,在 ...
- 嵌入式Linux驱动学习之路(十三)按键驱动-异步通知
之前的按键方式: 查询: 极度占用CPU资源 中断: 在读的时候产生休眠,在没有信号的时候永远不会返回. poll机制: 在中断的基础上加上超时时间. 异步通知就是通过信号来传送. 首先在应用程序中有 ...
- [No000079]罗辑思维2016.1.2日前的所有每日语音,python3做的网络爬虫
源码地址:https://github.com/charygao/Download_the_LouJiSiWei 写过很久了,vision1.0里有不少bug,今天重新整理修改了一下,运行了一下,2个 ...
- mac os 下搭建android开发环境
mac os 下搭建android开发环境 周银辉 mac os 下搭建android环境比较方便, 如下几个步骤: 1,安装jdk 先搞清楚自己是否已经安装,在命令行下:java -version, ...
- 基于thrift的微服务框架
前一阵开源过一个基于spring-boot的rest微服务框架,今天再来一篇基于thrift的微服务加框,thrift是啥就不多了,大家自行百度或参考我之前介绍thrift的文章, thrift不仅支 ...
- RequireJS shim 用法说明
RequireJS中如果使用AMD规范,在使用的过程中没有太多的问题,如果加载非AMD规范的JS文件,就需要使用Require中的shim. require.config({ paths:{ jque ...