All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.silverspoon.bulldog.linux.sysinfo.CpuInfo Maven / Gradle / Ivy

There is a newer version: 0.3.0
Show newest version
package io.silverspoon.bulldog.linux.sysinfo;

import java.util.HashMap;

import io.silverspoon.bulldog.linux.util.Commands;

public class CpuInfo {

   private static final String CPU_REVISION = "CPU revision";

   private static HashMap properties = new HashMap();

   static {
      String cpuInfo = Commands.cat("/proc/cpuinfo");
      String[] infos = cpuInfo.split("\n");
      for (String info : infos) {
         String[] tokens = info.split(":");
         if (tokens.length >= 2) {
            // System.out.println(tokens[0].trim() + " : " + tokens[1].trim());
            properties.put(tokens[0].trim(), tokens[1].trim());
         }
      }
   }

   public static String getCPURevision() {
      return properties.get(CPU_REVISION);
   }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy