< prev index next >

agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java

Print this page




  46     } else if (os.contains("Darwin") || os.contains("OS X")) {
  47       return "darwin";
  48     } else if (os.startsWith("Windows")) {
  49       return "win32";
  50     } else {
  51       throw new UnsupportedPlatformException("Operating system " + os + " not yet supported");
  52     }
  53   }
  54 
  55   /* Returns "sparc" for SPARC based platforms and "x86" for x86 based
  56      platforms. Otherwise returns the value of os.arch.  If the value
  57      is not recognized as supported, an exception is thrown instead. */
  58   public static String getCPU() throws UnsupportedPlatformException {
  59     String cpu = System.getProperty("os.arch");
  60     if (cpu.equals("i386") || cpu.equals("x86")) {
  61       return "x86";
  62     } else if (cpu.equals("sparc") || cpu.equals("sparcv9")) {
  63       return "sparc";
  64     } else if (cpu.equals("ia64") || cpu.equals("amd64") || cpu.equals("x86_64")) {
  65       return cpu;
  66     } else {


  67       try {
  68         Class pic = Class.forName("sun.jvm.hotspot.utilities.PlatformInfoClosed");
  69         AltPlatformInfo api = (AltPlatformInfo)pic.newInstance();
  70         if (api.knownCPU(cpu)) {
  71           return cpu;
  72         }
  73       } catch (Exception e) {}
  74       throw new UnsupportedPlatformException("CPU type " + cpu + " not yet supported");
  75     }
  76   }
  77 
  78   // this main is invoked from Makefile to make platform specific agent Makefile(s).
  79   public static void main(String[] args) {
  80     System.out.println(getOS());
  81   }
  82 }


  46     } else if (os.contains("Darwin") || os.contains("OS X")) {
  47       return "darwin";
  48     } else if (os.startsWith("Windows")) {
  49       return "win32";
  50     } else {
  51       throw new UnsupportedPlatformException("Operating system " + os + " not yet supported");
  52     }
  53   }
  54 
  55   /* Returns "sparc" for SPARC based platforms and "x86" for x86 based
  56      platforms. Otherwise returns the value of os.arch.  If the value
  57      is not recognized as supported, an exception is thrown instead. */
  58   public static String getCPU() throws UnsupportedPlatformException {
  59     String cpu = System.getProperty("os.arch");
  60     if (cpu.equals("i386") || cpu.equals("x86")) {
  61       return "x86";
  62     } else if (cpu.equals("sparc") || cpu.equals("sparcv9")) {
  63       return "sparc";
  64     } else if (cpu.equals("ia64") || cpu.equals("amd64") || cpu.equals("x86_64")) {
  65       return cpu;
  66     } else {if (cpu.equals("aarch64")) {
  67       return cpu;
  68     } else 
  69       try {
  70         Class pic = Class.forName("sun.jvm.hotspot.utilities.PlatformInfoClosed");
  71         AltPlatformInfo api = (AltPlatformInfo)pic.newInstance();
  72         if (api.knownCPU(cpu)) {
  73           return cpu;
  74         }
  75       } catch (Exception e) {}
  76       throw new UnsupportedPlatformException("CPU type " + cpu + " not yet supported");
  77     }
  78   }
  79 
  80   // this main is invoked from Makefile to make platform specific agent Makefile(s).
  81   public static void main(String[] args) {
  82     System.out.println(getOS());
  83   }
  84 }
< prev index next >