1 查看手机CPU信息

cmd——adb shell——cd /proc------cat cpuinfo

2 获取cpu的是arm指令集,armv7指令集、还是neon指令集

  1. /**
  2. *
  3. * [获取cpu类型和架构]
  4. *
  5. * @return
  6. * 三个参数类型的数组,第一个参数标识是不是ARM架构,第二个参数标识是V6还是V7架构,第三个参数标识是不是neon指令集
  7. */
  8. public static Object[] getCpuArchitecture() {
  9. if ((Integer) mArmArchitecture[1] != -1) {
  10. return mArmArchitecture;
  11. }
  12. try {
  13. InputStream is = new FileInputStream("/proc/cpuinfo");
  14. InputStreamReader ir = new InputStreamReader(is);
  15. BufferedReader br = new BufferedReader(ir);
  16. try {
  17. String nameProcessor = "Processor";
  18. String nameFeatures = "Features";
  19. String nameModel = "model name";
  20. String nameCpuFamily = "cpu family";
  21. while (true) {
  22. String line = br.readLine();
  23. String[] pair = null;
  24. if (line == null) {
  25. break;
  26. }
  27. pair = line.split(":");
  28. if (pair.length != 2)
  29. continue;
  30. String key = pair[0].trim();
  31. String val = pair[1].trim();
  32. if (key.compareTo(nameProcessor) == 0) {
  33. String n = "";
  34. for (int i = val.indexOf("ARMv") + 4; i < val.length(); i++) {
  35. String temp = val.charAt(i) + "";
  36. if (temp.matches("\\d")) {
  37. n += temp;
  38. } else {
  39. break;
  40. }
  41. }
  42. mArmArchitecture[0] = "ARM";
  43. mArmArchitecture[1] = Integer.parseInt(n);
  44. continue;
  45. }
  46. if (key.compareToIgnoreCase(nameFeatures) == 0) {
  47. if (val.contains("neon")) {
  48. mArmArchitecture[2] = "neon";
  49. }
  50. continue;
  51. }
  52. if (key.compareToIgnoreCase(nameModel) == 0) {
  53. if (val.contains("Intel")) {
  54. mArmArchitecture[0] = "INTEL";
  55. mArmArchitecture[2] = "atom";
  56. }
  57. continue;
  58. }
  59. if (key.compareToIgnoreCase(nameCpuFamily) == 0) {
  60. mArmArchitecture[1] = Integer.parseInt(val);
  61. continue;
  62. }
  63. }
  64. } finally {
  65. br.close();
  66. ir.close();
  67. is.close();
  68. }
  69. } catch (Exception e) {
  70. e.printStackTrace();
  71. }
  72. return mArmArchitecture;
  73. }

获取CPU信息的更多相关文章

  1. CPU测试--通过proc获取CPU信息

    adb shell cat /proc/stat | grep cpu > totalcpu0 此处第一行的数值表示的是CPU总的使用情况,所以我们只要用第一行的数字计算就可以了.下表解析第一行 ...

  2. [Mac] 获取cpu信息

    [Mac] 获取cpu信息 命令行获取cpu信息 sysctl machdep.cpu output like machdep.cpu.tsc_ccc.denominator: 0 machdep.c ...

  3. C++ 嵌入汇编 获取CPU信息

    #include "windows.h" #include "iostream" #include "string" using names ...

  4. c++获取cpu信息

    原文地址:http://blog.csdn.net/jamesliulyc/article/details/2028958 1.什么是cpuid指令 CPUID指令是intel IA32架构下获得CP ...

  5. CMD一键获取cpu信息

    windows + R 输入cmd打开CMD 输入wmic cpu get Name 获取cpu名称-即物理cpu数 cpu get NumberOfCores获取cpu核心数 cpu get Num ...

  6. 汇编实现获取CPU信息

    这是文章最后一次更新,加入了TLB与Cache信息等资料前言:论坛上面有人不明白CPUID指令的用法,于是就萌生写这篇文章的想法,若有错误话请大侠指出,谢谢了 ^^论坛的式样貌似有问题,若式样问题导致 ...

  7. 使用C#在Windows应用商店程序中获取CPU信息

    using Windows.Devices.Enumeration; string guidStr="{97FADB10-4E33-40AE-359C-8BEF029DBDD0}" ...

  8. Python 脚本之获取CPU信息

    #!/usr/bin/env Python from __future__ import print_function from collections import OrderedDict impo ...

  9. python3监控系统资源最终版(获取CPU,内存,磁盘,网卡等信息),返回json格式。

    #!/usr/bin/env python3 #-*- coding:utf-8 -*- #create at 2018-12-07 'this is a system monitor scripts ...

随机推荐

  1. 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 ...

  2. 在cmd和terminal怎么粘贴?

    在osx, linux的terminal 以及windows的 cmd实现粘贴是coder经常要做的事,鼠标右键,下拉菜单中单击粘贴paste.但是这显得笨拙,及其不快捷.但是正常使用的command ...

  3. COGS 265线段覆盖[线段树]

    265. 线段覆盖 ★★☆   输入文件:xdfg.in   输出文件:xdfg.out   简单对比时间限制:2 s   内存限制:20 MB [问题描述] 有一根长度为 L 的白色条状物.有两种操 ...

  4. Oracle 增删改查

    Oracle入门案例: 1.创建实体类Student 并重写ToString方法 package cn.happy.entity; public class Student { public Inte ...

  5. 第19章 集合框架(3)-Map接口

    第19章 集合框架(3)-Map接口 1.Map接口概述 Map是一种映射关系,那么什么是映射关系呢? 映射的数学解释 设A,B是两个非空集合,如果存在一个法则,使得对A中的每一个元素a,按法则f,在 ...

  6. 嵌入式Linux驱动学习之路(十三)按键驱动-异步通知

    之前的按键方式: 查询: 极度占用CPU资源 中断: 在读的时候产生休眠,在没有信号的时候永远不会返回. poll机制: 在中断的基础上加上超时时间. 异步通知就是通过信号来传送. 首先在应用程序中有 ...

  7. [No000079]罗辑思维2016.1.2日前的所有每日语音,python3做的网络爬虫

    源码地址:https://github.com/charygao/Download_the_LouJiSiWei 写过很久了,vision1.0里有不少bug,今天重新整理修改了一下,运行了一下,2个 ...

  8. mac os 下搭建android开发环境

    mac os 下搭建android开发环境 周银辉 mac os 下搭建android环境比较方便, 如下几个步骤: 1,安装jdk 先搞清楚自己是否已经安装,在命令行下:java -version, ...

  9. 基于thrift的微服务框架

    前一阵开源过一个基于spring-boot的rest微服务框架,今天再来一篇基于thrift的微服务加框,thrift是啥就不多了,大家自行百度或参考我之前介绍thrift的文章, thrift不仅支 ...

  10. RequireJS shim 用法说明

    RequireJS中如果使用AMD规范,在使用的过程中没有太多的问题,如果加载非AMD规范的JS文件,就需要使用Require中的shim. require.config({ paths:{ jque ...