letmedanz

Untitled

Jan 25th, 2015
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.57 KB | None | 0 0
  1. <<<<<<< HEAD
  2.  
  3. * Processor : ARMv7 Processor rev 2 (v7l)
  4. * BogoMIPS : 272.62
  5. * BogoMIPS : 272.62
  6. *
  7. * On kernel 3.10 this changed, it is now the last
  8. * line. So let's read the whole thing, search
  9. * specifically for "Processor" or "model name"
  10. * and retain the old
  11. * "first line" as fallback.
  12. * Also, use "processor : <id>" to count cores
  13.  
  14. */
  15. BufferedReader ci = new BufferedReader(new FileReader(FILENAME_PROC_CPUINFO));
  16. String firstLine = ci.readLine();
  17. String latestLine = firstLine;
  18. while (latestLine != null) {
  19. if (latestLine.startsWith("Processor")
  20. || latestLine.startsWith("model name"))
  21. result = latestLine.split(":")[1].trim();
  22. if (latestLine.startsWith("processor"))
  23. coreCount++;
  24. latestLine = ci.readLine();
  25. }
  26. if (result == null && firstLine != null) {
  27. result = firstLine.split(":")[1].trim();
  28. }
  29. /* Don't do this. hotplug throws off the count
  30. if (coreCount > 1) {
  31. result = result + " (x" + coreCount + ")";
  32. }
  33. */
  34. ci.close();
  35. =======
  36. * Processor : ARMv7 Processor rev 2 (v7l)
  37. * BogoMIPS : 272.62
  38. *
  39. * This needs updating, since
  40. *
  41. * Hammerhead output :
  42. * Processor : ARMv7 Processor rev 0 (v7l)
  43. * processor : 0
  44. * BogoMIPS : xxx
  45. *
  46. * Shamu output :
  47. * processor : 0
  48. * model name : ARMv7 Processor rev 1 (v7l)
  49. * BogoMIPS : xxx
  50. *
  51. * Continue reading the file until running into a line starting
  52. * with either "model name" or "Processor" to meet both
  53. */
  54.  
  55. BufferedReader reader = new BufferedReader(new FileReader(FILENAME_PROC_CPUINFO), 256);
  56.  
  57. String Line = reader.readLine();
  58.  
  59. while (Line != null) {
  60. if (Line.indexOf("model name") == -1 &&
  61. Line.indexOf("Processor" ) == -1 ) {
  62. Line = reader.readLine();
  63. } else {
  64. result = Line.split(":")[1].trim();
  65. break;
  66. }
  67. }
  68.  
  69. reader.close();
  70.  
  71. >>>>>>> slim/lp5.0
Advertisement
Add Comment
Please, Sign In to add comment