SourceForge.net Logo
Home

PerfUtil Java API: SysUtil class




GetPerfutilVersion

     //
     // Get PerfUtil version as follows:
     //
     //    3     2 2     1 1
     //    1     4 3     6 5             0
     //   +-------+-------+-------+-------+
     //   | Major | Minor |    Revision   |
     //   +-------+-------+-------+-------+
     //       0       0             0          Error
     //
     // Use GetVersionMajor/Minor/Revision() to break apart.
     //
     static native int GetPerfutilVersion();




GetPerddVersion

     //
     // Get PERFDD version as follows:
     //
     //    3     2 2     1 1
     //    1     4 3     6 5             0
     //   +-------+-------+-------+-------+
     //   | Major | Minor |    Revision   |
     //   +-------+-------+-------+-------+
     //       0       0             0          Error
     //
     // Use GetVersionMajor/Minor/Revision() to break apart.
     //
     static native int GetPerddVersion();




IsDeviceDriverInstalled

     //
     // Returns whether or not PERFDD is installed and loaded
     //
     static native boolean IsDeviceDriverInstalled();




GetNumberOfProcessors

     //
     // Returns number of active (configured) processors.
     // The returned number is the number of processor cores visible to the OS.
     //
     static native int GetNumberOfProcessors();




Is32bitSystem

     //
     // Returns whether or not this is a 32-bit system (32-bit OS)
     //
     static native boolean Is32bitSystem();

Is64bitSystem

     //
     // Returns whether or not this is a 64-bit system (64-bit OS)
     //
     static native boolean Is64bitSystem();

IsSmpSystem

     //
     // Returns whether or not this is an SMP system.
     //
     static native boolean IsSmpSystem();

IsVirtualMachine

     //
     // Returns whether or not OS is running in a virtual machine
     //
     static native boolean IsVirtualMachine();

IsTprofSupported

     //
     // Returns whether or not time-based TProf is supported.
     //
     static native boolean IsTprofSupported();

IsEventTprofSupported

     //
     // Returns whether or not event-based TProf is supported.
     //
     static native boolean IsEventTprofSupported();

IsTprofActive

     //
     // Returns whether or not TProf (event or time-based) is currently
     // active/in use.
     //
     static native boolean IsTprofActive();

IsCallstackSamplingSupported

     //
     // Returns whether or not time-based Java Callstack Sampling is supported.
     //
     static native boolean IsCallstackSamplingSupported();

IsEventCallstackSamplingSupported

     //
     // Returns whether or not event-based Java Callstack Sampling is supported.
     //
     static native boolean IsEventCallstackSamplingSupported();

IsCallstackSamplingActive

     //
     // Returns whether or not Java Callstack Sampling (event or time-based) is
     // currently active/in use.
     //
     static native boolean IsCallstackSamplingActive();

IsCallstackSamplingActiveForCurrentProcess

     //
     // Returns whether or not Java Callstack Sampling (event or time-based) is
     // currently active/in use for the current process.
     //
     static native boolean IsCallstackSamplingActiveForCurrentProcess();

IsItraceSupported

     //
     // Returns whether or not ITrace (Instruction Tracing) is supported.
     //
     static native boolean IsItraceSupported();

IsCpiSupported

     //
     // Returns whether or not CPI (Cycles Per Instruction) measurement is
     // supported.
     //
     static native boolean IsCpiSupported();

IsAiSupported

     //
     // Returns whether or not AI (Above Idle/CPU Utilization) measurement is
     // supported.
     //
     static native boolean IsAiSupported();

IsAiActive

     //
     // Returns whether or not AI (Above Idle/CPU Utilization) measurement is
     // currently active/in use.
     //
     static native boolean IsAiActive();

IsPttSupported

     //
     // Returns whether or not PTT (Per-Thread Time) measurement is supported.
     //
     static native boolean IsPttSupported();

IsPttActive

     //
     // Returns whether or not PTT (Per-Thread Time) measurement is currently
     // active/in use.
     //
     static native boolean IsPttActive();

IsPttActiveForCurrentProcess

     //
     // Returns whether or not PTT (Per-Thread Time) measurement is currently
     // active/in use for the current process.
     //
     static native boolean IsPttActiveForCurrentProcess();

IsPerfCounterAccessSupported

     //
     // Returns whether or not access to the hardware Performance Counters is
     // supported.
     //
     static native boolean IsPerfCounterAccessSupported();

IsPerfCounterEventAccessSupported

     //
     // Returns whether or not access to the hardware Performance Counter Event
     // is supported. Events are completely managed by PerfUtil thus removing
     // the need for the user to know the details necessary to configure the
     // performance counter controls.
     //
     static native boolean IsPerfCounterEventAccessSupported();

IsMsrAccessSupported

     //
     // Returns whether or not access to the hardware Machine Specific Registers
     // (MSR) is supported.
     //
     static native boolean IsMsrAccessSupported();




ReadCycles

     //
     // Read processor cycle counter (TimeStamp Counter register)
     // on the current processor.
     //
     static native long ReadCycles();

     //
     // Read processor cycle counter (TimeStamp Counter register)
     // on the requested processor.
     //
     static native long ReadCycles(int cpu);




CyclesToSeconds

     //
     // Given two timestamps, CyclesStart and CyclesEnd, returns the elapsed
     // time (CyclesEnd-CyclesStart) converted to Seconds.
     // * The int/long version of the method will round down to the second.
     //   If the time elapsed from CyclesStart to CyclesEnd is less than one second
     //   the int/long methods will return 0.
     // * For the most accuracy use the double method.
     //
     static native double dCyclesToSeconds(long CyclesStart, long CyclesEnd);
     static native int    iCyclesToSeconds(long CyclesStart, long CyclesEnd);
     static native long   lCyclesToSeconds(long CyclesStart, long CyclesEnd);




CyclesToMilliseconds

     //
     // Given two timestamps, CyclesStart and CyclesEnd, returns the elapsed
     // time (CyclesEnd-CyclesStart) converted to Milliseconds.
     // * The int/long version of the method will round down to the millisecond.
     //   If the time elapsed from CyclesStart to CyclesEnd is less than one millisecond
     //   the int/long methods will return 0.
     // * For the most accuracy use the double method.
     //
     static native double dCyclesToMilliseconds(long CyclesStart, long CyclesEnd);
     static native int    iCyclesToMilliseconds(long CyclesStart, long CyclesEnd);
     static native long   lCyclesToMilliseconds(long CyclesStart, long CyclesEnd);




CyclesToMicroseconds

     //
     // Given two timestamps, CyclesStart and CyclesEnd, returns the elapsed
     // time (CyclesEnd-CyclesStart) converted to Microseconds.
     // * The int/long version of the method will round down to the microsecond.
     //   If the time elapsed from CyclesStart to CyclesEnd is less than one microsecond
     //   the int/long methods will return 0.
     // * For the most accuracy use the double method.
     //
     static native double dCyclesToMicroseconds(long CyclesStart, long CyclesEnd);
     static native int    iCyclesToMicroseconds(long CyclesStart, long CyclesEnd);
     static native long   lCyclesToMicroseconds(long CyclesStart, long CyclesEnd);




GetWindowsVersion

     //
     // Get Windows version as follows:
     //
     //    3     2 2     1 1
     //    1     4 3     6 5             0
     //   +-------+-------+-------+-------+
     //   | Major | Minor |    Build#     |
     //   +-------+-------+-------+-------+
     //
     //       0       0             0          Error
     //       4       0          1381          Windows NT 4.0
     //       5       0          2195          Windows 2000
     //       5       1          2600          Windows XP
     //       5       2          3790          Windows Server 2003
     //       6       0          6000          Windows Vista
     //       6       0          6001          Windows Server 2008
     //
     // Don't count on the build number. Only use major and minor versions.
     // Use GetVersionMajor/Minor/BuildNumber() to break apart.
     //
     static native int GetWindowsVersion();




GetVersionMajor
GetVersionMinor
GetVersionRevision
GetVersionBuildNumber

     //
     // Returns Major, Minor or Revision/Build# from a given version
     //
     static int GetVersionMajor(int version);
     static int GetVersionMinor(int version);
     static int GetVersionRevision(int version);
     static int GetVersionBuildNumber(int version);




GetWindowsSPLevel

     //
     // Get Windows service pack level
     // * -1 means error
     // * 0 means GA
     //
     static native int GetWindowsSPLevel();




GetWindowsName

     //
     // Get Windows version name as follows:
     //
     // * "Windows 2000"
     // * "Windows XP"
     // * "Windows Server 2003"
     // * "Windows Vista"
     // * "Windows Server 2008"
     //
     static native String GetWindowsName();




GetCurrentProcessId

     //
     // Get Process ID (PID) for current process
     //
     static native int GetCurrentProcessId();




GetCurrentThreadId

     //
     // Get Thread ID (TID) for current thread
     //
     static native int GetCurrentThreadId();




GetProcessPriorityClass
SetProcessPriorityClass

     //
     // Set/Get priority class for/of a process
     //
     // * Can use JPerf.CURRENT_PID for the current process
     // * 0 means error on GetProcessPriorityClass()
     // * 0 means success on SetProcessPriorityClass()
     //
     static native int GetProcessPriorityClass(int pid);
     static native int SetProcessPriorityClass(int pid, int priority_class);




GetThreadPriority
SetThreadPriority

     //
     // Set/Get priority for/of a thread
     //
     // * Can use JPerf.CURRENT_TID for the current thread
     // * THREAD_PRIORITY_ERROR_RETURN means error on GetThreadPriority()
     // * 0 means success on SetThreadPriority()
     //
     static native int GetThreadPriority(int tid);
     static native int SetThreadPriority(int tid, int priority);




GetProcessAffinityMask
SetProcessAffinityMask

     //
     // Set/Get process affinity mask
     //
     // * Can use JPerf.CURRENT_PID for the current process
     // * 0 means error on GetProcessAffinityMask()
     // * 0 means success on SetProcessAffinityMask()
     //
     static native long GetProcessAffinityMask(int pid);
     static native int  SetProcessAffinityMask(int pid, long mask);




SetThreadAffinityMask

     //
     // Set/Get thread affinity mask
     /
     // * Can use JPerf.CURRENT_TID for the current thread
     //
     static native int SetThreadAffinityMask(int tid, long mask);




GetCurrentDirectory
GetSystemWindowsDirectory
GetWindowsDirectory
GetSystemDirectory

     //
     // See the Win32 documentation for these ...
     // Method names are the same as the Win32 APIs.
     //
     static native String GetCurrentDirectory();
     static native String GetSystemWindowsDirectory();
     static native String GetWindowsDirectory();
     static native String GetSystemDirectory();




GetPhysicalMemoryLoad

     //
     // Returns a number between 0 and 100 that specifies the approximate
     // percentage of physical memory that is in use (0 indicates no memory
     // use and 100 indicates full memory use).
     //
     // * -1 means error.
     //
     static native int GetPhysicalMemoryLoad();

GetPhysicalMemorySize
GetPhysicalMemoryAvailable
GetVirtualMemorySize
GetVirtualMemoryAvailable
GetPageFileSize
GetPageFileAvailable

     //
     // Return memory sizes in bytes.
     // * -1 means error.
     //
     static native long GetPhysicalMemorySize();
     static native long GetPhysicalMemoryAvailable();
     static native long GetVirtualMemorySize();
     static native long GetVirtualMemoryAvailable();
     static native long GetPageFileSize();
     static native long GetPageFileAvailable();