Created
September 6, 2012 19:17
-
-
Save nicoulaj/3659659 to your computer and use it in GitHub Desktop.
Runtime.availableProcessors() gives info about available resources, not affinity which occurs at scheduling level
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/sh | |
cat > PrintAvailableProcs.java <<EOF | |
public class PrintAvailableProcs { | |
public static void main(String[] args) { | |
System.out.println(Runtime.getRuntime().availableProcessors()); | |
} | |
} | |
EOF | |
javac PrintAvailableProcs.java | |
echo "cpuinfo: $(grep -c processor /proc/cpuinfo)" | |
echo "java: $(java PrintAvailableProcs)" | |
echo "bound with taskset: $(taskset -c 0 java PrintAvailableProcs)" | |
echo "bound with numactl: $(numactl -C 0 java PrintAvailableProcs)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment