SourceForge.net Logo
Home

PerfUtil Java API: Msr class




Write

     //
     // Writes value 'value' to MSR number 'msr' in given processor(s).
     //
     // !!!!! USER BEWARE !!!!!
     //
     // Input:
     // - cpu:      Processor on which MSR should be written, or ALL_CPUS
     // - msr:      Number of MSR to write to
     // - value:    Value to be written to the MSR
     //
     // Returns:
     // - 0:        success
     // - non-zero: values not written to 1 or more processors
     //
     // Notes:
     // - To write MSR on all processors specify cpu as ALL_CPUS
     // - No MSR is written for invalid MSRs.
     // - The value written to the MSR is not checked in any way.
     // - ***** Be very careful on what and where you write *****
     //   Results can be disastrous if you don't know what you're doing or
     //   if you write to MSRs in use by the system.
     //
     static native int Write(int cpu, int msr, long value);

Read

     //
     // Reads MSR number 'msr' in given processor and returns its value.
     //
     // Input:
     // - cpu:       Processor on which MSR should be read, or ALL_CPUS
     // - msr:       Number of MSR to read
     // - MsrValues: Array that will contain value of MSR read, one element
     //              per processor.
     //
     // Returns:
     // - 0:        success
     // - non-zero: values not read from 1 or more processors
     //
     // Notes:
     // - To read MSR on all processors specify cpu as ALL_CPUS
     // - A value of zero (0) is returned for invalid MSRs.
     // - MsrValues[] is indexed by CPU number. The largest valid
     //   index is (CPUCnt - 1).
     //
     static native int Read(int cpu, int msr, long[] MsrValues);