/mobile Handheld Friendly website
Ubuntu : Intel® Q6600® one 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.76 | 0.78 | 21,000 | 432 | 0% 0% 3% 99% |
| 5,000,000 | 3.68 | 3.68 | 48,300 | 432 | 1% 1% 1% 100% |
| 50,000,000 | 18.11 | 18.13 | 133,192 | 432 | 1% 0% 0% 100% |
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) 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); } } } }
Mon, 21 Jan 2013 08:45:54 GMT MAKE: mv threadring.java-5.java threadring.java /usr/local/src/jdk1.7.0_11/bin/javac threadring.java 0.52s 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