/mobile Handheld Friendly website
x64 Ubuntu : Intel® Q6600® quad-core |
Each table row shows performance measurements for this Java 7 program with a particular command-line input value N.
| N | CPU secs | Elapsed secs | Memory KB | Code B | ≈ CPU Load |
|---|---|---|---|---|---|
| 500,000 | 0.73 | 0.44 | 18,172 | 432 | 33% 34% 63% 37% |
| 5,000,000 | 2.58 | 2.11 | 75,660 | 432 | 25% 29% 35% 28% |
| 50,000,000 | 18.63 | 16.89 | 142,128 | 432 | 29% 23% 24% 31% |
Read the ↓ make, command line, and program output logs to see how this program was run.
Read thread-ring benchmark to see what this program should do.
java version "1.7.0_11"
Java(TM) SE Runtime Environment (build 1.7.0_11-b21)
Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)
/** * The Computer Language Benchmarks Game * http://benchmarksgame.alioth.debian.org/ * contributed by Birju Prajapati */ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class threadring { private static final int TOTAL_NODES = 503; private static final ExecutorService EXECUTOR = Executors.newFixedThreadPool(TOTAL_NODES); private static Node firstNode; private static Node lastNode; public static void main(String[] args) { firstNode = new Node(1); lastNode.next = firstNode; firstNode.push(Integer.parseInt(args[0])); } private static class Node implements Runnable { private final int id; private Node next; private int token; public Node(int id) { this.id = id; if (id++ == TOTAL_NODES) { lastNode = this; } else { next = new Node(id); } } private void push(int token) { this.token = token; EXECUTOR.execute(this); } public void run() { if (token-- != 0) { next.push(token); } else { System.out.println(id); System.exit(0); } } } }
Sun, 20 Jan 2013 16:37:35 GMT MAKE: mv threadring.java-5.java threadring.java /usr/local/src/jdk1.7.0_11/bin/javac threadring.java 0.70s to complete and log all make actions COMMAND LINE: /usr/local/src/jdk1.7.0_11/bin/java -server -XX:+TieredCompilation -XX:+AggressiveOpts threadring 50000000 PROGRAM OUTPUT: 292