GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — JavaLinuxUndervolt/src/BusyThread.java at master · zmalrobot/JavaLinuxUndervolt Expand file tree/ Copy pathBusyThread.javaMore file actions 36 lines (33 loc) · 1.06 KB / Copy pathBusyThread.javaFile metadata and controls36 lines (33 loc) · 1.06 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 public class BusyThread extends Thread{ private double load; private long duration; /** * Constructor which creates the thread * @param name Name of this thread * @param load Load % that this thread should generate * @param duration Duration that this thread should generate the load for */ public BusyThread(String name, double load, long duration) { super(name); this.load = load; this.duration = duration; } /** * Generates the load when run */ @Override public void run() { long startTime = System.currentTimeMillis(); try { // Loop for the given duration while (System.currentTimeMillis() - startTime < duration) { // Every 100ms, sleep for the percentage of unladen time if (System.currentTimeMillis() % 100 == 0) { Thread.sleep((long) Math.floor((1 - load) * 100)); } } } catch (InterruptedException e) { e.printStackTrace(); } } } |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |