From: bdemsky Date: Fri, 25 Jun 2010 23:51:08 +0000 (+0000) Subject: more changes X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=bacb84f4097e4cdc200c649e74e9bec541bac637;p=IRC.git more changes --- diff --git a/Robust/TransSim/FlexScheduler.java b/Robust/TransSim/FlexScheduler.java index 8fc77ce9..2a050305 100644 --- a/Robust/TransSim/FlexScheduler.java +++ b/Robust/TransSim/FlexScheduler.java @@ -82,6 +82,40 @@ public class FlexScheduler extends Thread { public static final int ATTACKTIME=12; public static final int ATTACKTHREAD=13; + public static String getName(int policy) { + switch (policy) { + case LAZY: + return new String("LAZY"); + case COMMIT: + return new String("COMMIT"); + case ATTACK: + return new String("ATTACK"); + case SUICIDE: + return new String("SUICIDE"); + case TIMESTAMP: + return new String("TIMESTAMP"); + case LOCK: + return new String("LOCK"); + case LOCKCOMMIT: + return new String("LOCKCOMMIT"); + case RANDOM: + return new String("RANDOM"); + case KARMA: + return new String("KARMA"); + case POLITE: + return new String("POLITE"); + case ERUPTION: + return new String("ERUPTION"); + case THREAD: + return new String("THREAD"); + case ATTACKTIME: + return new String("ATTACKTIME"); + case ATTACKTHREAD: + return new String("ATTACKTHREAD"); + } + return null; + } + PriorityQueue eq; int policy; boolean[] aborted; diff --git a/Robust/TransSim/TransSim.java b/Robust/TransSim/TransSim.java index 8e2cb951..22bc2590 100644 --- a/Robust/TransSim/TransSim.java +++ b/Robust/TransSim/TransSim.java @@ -23,131 +23,35 @@ public class TransSim { Plot p=new Plot("plot"); Plot pa=new Plot("plotabort"); + Plot ps=new Plot("plotstall"); + Plot pb=new Plot("plotbackoff"); + Plot pat=new Plot("plotaborttime"); + + int[] policies=new int[]{FlexScheduler.LAZY, FlexScheduler.COMMIT, FlexScheduler.ATTACK, FlexScheduler.SUICIDE, FlexScheduler.TIMESTAMP, FlexScheduler.LOCK, FlexScheduler.LOCKCOMMIT, FlexScheduler.RANDOM, FlexScheduler.KARMA, FlexScheduler.POLITE, FlexScheduler.ERUPTION, FlexScheduler.THREAD, FlexScheduler.ATTACKTIME, FlexScheduler.ATTACKTHREAD}; for(int i=1;i<40;i++) { System.out.println("i="+i); numThreads=i; Executor e=new Executor(numThreads, numTrans, deltaTrans, numObjects, numAccesses, deltaAccesses, readPercent, delay, deltaDelay, nonTrans, deltaNonTrans, splitobjects, splitaccesses, readPercentSecond); System.out.println(e.maxTime()); - FlexScheduler ls=new FlexScheduler(e, FlexScheduler.LAZY, null); - ls.dosim(); - System.out.println("Lazy Time="+ls.getTime()); - System.out.println("Aborts="+ls.getAborts()+" Commit="+ls.getCommits()); - p.getSeries("LAZY").addPoint(i, ls.getTime()); - pa.getSeries("LAZY").addPoint(i, 100.0*((double)ls.getAborts())/((double)(ls.getAborts()+ls.getCommits()))); - - //Lock object accesses - ls=new FlexScheduler(e, FlexScheduler.LOCK, abortThreshold, abortRatio, deadlockdepth, null); - ls.dosim(); - System.out.println("Deadlock count="+ls.getDeadLockCount()); - System.out.println("Lock Abort="+ls.getTime()); - System.out.println("Aborts="+ls.getAborts()+" Commit="+ls.getCommits()); - p.getSeries("LOCK").addPoint(i, ls.getTime()); - pa.getSeries("LOCK").addPoint(i, 100.0*((double)ls.getAborts())/((double)(ls.getAborts()+ls.getCommits()))); - - //Lock Commit object accesses - ls=new FlexScheduler(e, FlexScheduler.LOCKCOMMIT, abortThreshold, abortRatio, deadlockdepth, null); - ls.dosim(); - System.out.println("Deadlock count="+ls.getDeadLockCount()); - System.out.println("LockCommit Abort="+ls.getTime()); - System.out.println("Aborts="+ls.getAborts()+" Commit="+ls.getCommits()); - p.getSeries("LOCKCOMMIT").addPoint(i, ls.getTime()); - pa.getSeries("LOCKCOMMIT").addPoint(i, 100.0*((double)ls.getAborts())/((double)(ls.getAborts()+ls.getCommits()))); - - //Kill others at commit - ls=new FlexScheduler(e, FlexScheduler.COMMIT, null); - ls.dosim(); - System.out.println("Fast Abort="+ls.getTime()); - System.out.println("Aborts="+ls.getAborts()+" Commit="+ls.getCommits()); - p.getSeries("COMMIT").addPoint(i, ls.getTime()); - pa.getSeries("COMMIT").addPoint(i, 100.0*((double)ls.getAborts())/((double)(ls.getAborts()+ls.getCommits()))); - - //Eager attack - ls=new FlexScheduler(e, FlexScheduler.ATTACK, null); - ls.dosim(); - System.out.println("Attack Abort="+ls.getTime()); - System.out.println("Aborts="+ls.getAborts()+" Commit="+ls.getCommits()); - p.getSeries("ATTACK").addPoint(i, ls.getTime()); - pa.getSeries("ATTACK").addPoint(i, 100.0*((double)ls.getAborts())/((double)(ls.getAborts()+ls.getCommits()))); - - //Eager polite - ls=new FlexScheduler(e, FlexScheduler.SUICIDE, null); - ls.dosim(); - System.out.println("Suicide Abort="+ls.getTime()); - System.out.println("Aborts="+ls.getAborts()+" Commit="+ls.getCommits()); - p.getSeries("SUICIDE").addPoint(i, ls.getTime()); - pa.getSeries("SUICIDE").addPoint(i, 100.0*((double)ls.getAborts())/((double)(ls.getAborts()+ls.getCommits()))); - - //Karma - ls=new FlexScheduler(e, FlexScheduler.TIMESTAMP, null); - ls.dosim(); - System.out.println("Timestamp Abort="+ls.getTime()); - System.out.println("Aborts="+ls.getAborts()+" Commit="+ls.getCommits()); - p.getSeries("TIMESTAMP").addPoint(i, ls.getTime()); - pa.getSeries("TIMESTAMP").addPoint(i, 100.0*((double)ls.getAborts())/((double)(ls.getAborts()+ls.getCommits()))); - - //Karma - ls=new FlexScheduler(e, FlexScheduler.RANDOM, null); - ls.dosim(); - System.out.println("Random Abort="+ls.getTime()); - System.out.println("Aborts="+ls.getAborts()+" Commit="+ls.getCommits()); - p.getSeries("RANDOM").addPoint(i, ls.getTime()); - pa.getSeries("RANDOM").addPoint(i, 100.0*((double)ls.getAborts())/((double)(ls.getAborts()+ls.getCommits()))); - - //Karma - ls=new FlexScheduler(e, FlexScheduler.KARMA, null); - ls.dosim(); - System.out.println("Karma Abort="+ls.getTime()); - System.out.println("Aborts="+ls.getAborts()+" Commit="+ls.getCommits()); - p.getSeries("KARMA").addPoint(i, ls.getTime()); - pa.getSeries("KARMA").addPoint(i, 100.0*((double)ls.getAborts())/((double)(ls.getAborts()+ls.getCommits()))); - - //Karma - ls=new FlexScheduler(e, FlexScheduler.POLITE, null); - ls.dosim(); - System.out.println("Polit Abort="+ls.getTime()); - System.out.println("Aborts="+ls.getAborts()+" Commit="+ls.getCommits()); - p.getSeries("POLITE").addPoint(i, ls.getTime()); - pa.getSeries("POLITE").addPoint(i, 100.0*((double)ls.getAborts())/((double)(ls.getAborts()+ls.getCommits()))); - - //Karma - ls=new FlexScheduler(e, FlexScheduler.ERUPTION, null); - ls.dosim(); - System.out.println("Eruption Abort="+ls.getTime()); - System.out.println("Aborts="+ls.getAborts()+" Commit="+ls.getCommits()); - p.getSeries("ERUPTION").addPoint(i, ls.getTime()); - pa.getSeries("ERUPTION").addPoint(i, 100.0*((double)ls.getAborts())/((double)(ls.getAborts()+ls.getCommits()))); - - - //Karma - ls=new FlexScheduler(e, FlexScheduler.THREAD, null); - ls.dosim(); - System.out.println("ThreadPriority Abort="+ls.getTime()); - System.out.println("Aborts="+ls.getAborts()+" Commit="+ls.getCommits()); - p.getSeries("THPRIORITY").addPoint(i, ls.getTime()); - pa.getSeries("THPRIORITY").addPoint(i, 100.0*((double)ls.getAborts())/((double)(ls.getAborts()+ls.getCommits()))); - - - //attack time - ls=new FlexScheduler(e, FlexScheduler.ATTACKTIME, null); - ls.dosim(); - System.out.println("ThreadPriority Abort="+ls.getTime()); - System.out.println("Aborts="+ls.getAborts()+" Commit="+ls.getCommits()); - p.getSeries("ATTACKTIME").addPoint(i, ls.getTime()); - pa.getSeries("ATTACKTIME").addPoint(i, 100.0*((double)ls.getAborts())/((double)(ls.getAborts()+ls.getCommits()))); - - - //attack thread - ls=new FlexScheduler(e, FlexScheduler.ATTACKTHREAD, null); - ls.dosim(); - System.out.println("ThreadPriority Abort="+ls.getTime()); - System.out.println("Aborts="+ls.getAborts()+" Commit="+ls.getCommits()); - p.getSeries("ATTACKTHREAD").addPoint(i, ls.getTime()); - pa.getSeries("ATTACKTHREAD").addPoint(i, 100.0*((double)ls.getAborts())/((double)(ls.getAborts()+ls.getCommits()))); - // Scheduler s=new Scheduler(e, besttime); - //s.dosim(); - //System.out.println("Optimal Time="+s.getTime()); + for(int j=0;j