Created
December 22, 2018 15:38
-
-
Save mageddo/e7fb867f965ffd97a56f78be6e61618f to your computer and use it in GitHub Desktop.
Get TDP cpu information
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class HexToDecimal { | |
public static void main(String[] args) { | |
System.out.println(Integer.parseInt(new Scanner(System.in).nextLine(), 16)); | |
} | |
} | |
import java.util.Locale; | |
import java.util.Objects; | |
import java.util.Scanner; | |
public class MsrWatts { | |
public static void main(String[] args) { | |
Locale.setDefault(Locale.ENGLISH); | |
final double power = 0.125; | |
final int msr = Integer.parseInt(new Scanner(System.in).nextLine(), 16); | |
if(args.length == 0 || Objects.equals(args[0], "-d")){ | |
System.out.printf("%.2f%n", msr * power); | |
} else if(Objects.equals(args[0], "-h")) { | |
System.out.printf("%.2f%n", msr / power); | |
} else { | |
System.out.println("unknown option"); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "max tdp" | |
rdmsr -f 14:0 0x610 | java msr2watts.java | |
echo "turbo boost tdp" | |
rdmsr -f 46:32 0x610 | java msr2watts.java |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment