package com.mindprod.pentium;
/**
* Access Pentium/AMD specific features. Uses JNI native C++/ASM code that only works on Vista, XP, Windows 2000,
* Windows NT and Windows 98.
*
* @author Roedy Green, Canadian Mind Products
* @version 1.3 2007-06-03
*/
public final class Pentium
{
/**
* undisplayed copyright notice
*/
public static final String EMBEDDED_COPYRIGHT =
"copyright (c) 2005-2008 Roedy Green, Canadian Mind Products, http://mindprod.com";
private static final String RELEASE_DATE = "2007-06-03";
/**
* embedded version string.
*/
public static final String VERSION_STRING = "1.3";
/**
* Get the brand/model of the CPU.
*
* @return brand, e.g. "AMD Athlon(TM) XP 2000+"
*/
public static native String cpuIdBrand();
/**
* Get the instruction set family of the CPU.
*
* @return family, possibly null if not Pentium.
*/
public static native int cpuIdFamily();
/**
* Get the model of the CPU.
*
* @return model, possibly null if not Pentium.
*/
public static native int cpuIdModel();
/**
* Get the stepping ID of the CPU.
*
* @return stepping ID.
*/
public static native int cpuIdStep();
/**
* Get the vendor ID of the CPU.
*
* @return vendor, "GenuineIntel" for Intel chips, "AuthenticAMD" for AMD.
*/
public static native String cpuIdVendor();
/**
* Get the cpu Serial number
*
* @return family, possibly 0 if not Pentium.
*/
public static native long cpuSerNo();
/**
* Get the time stamp counter register with the RDTSC instruction giving the count of machine cycles since last
* boot. This is very high resolution timer, with frequency matching the cpu clock crystal, not any defined time
* unit.
*
* @return RDTSC Timestamp counter.
*/
public static native long rdtsc();
static
{
System.loadLibrary( "nativepentium" );
}
/**
* test harness
*
* @param args not used
*/
public static void main( String[] args )
{
System.out.println( "cpuIdVendor:" + Pentium.cpuIdVendor() );
System.out.println( "cpuIdBrand:" + Pentium.cpuIdBrand() );
System.out.println( "cpuIdStep:" + Pentium.cpuIdStep() );
System.out.println( "cpuIdModel:" + Pentium.cpuIdModel() );
System.out.println( "cpuIdFamily:" + Pentium.cpuIdModel() );
System.out.println( "cpuSerNo:" + Pentium.cpuSerNo() );
System.out.println( "rdtsc:" + Pentium.rdtsc() );
}
}