public CriticalSectionInterferenceGraph(List<CriticalSection> criticalSections, MhpTester mhp, boolean optionOneGlobalLock, boolean optionLeaveOriginalLocks, boolean optionIncludeEmptyPossibleEdges) { this.criticalSections = criticalSections; this.mhp = mhp; this.pta = Scene.v().getPointsToAnalysis(); this.optionOneGlobalLock = optionOneGlobalLock; this.optionLeaveOriginalLocks = optionLeaveOriginalLocks; this.optionIncludeEmptyPossibleEdges = optionIncludeEmptyPossibleEdges; calculateGroups(); }
public void printTable(Collection<CriticalSection> AllTransactions, MhpTester mhp) { G.v().out.println("[transaction-table] "); Iterator<CriticalSection> tnIt7 = AllTransactions.iterator(); while(tnIt7.hasNext()) { CriticalSection tn = tnIt7.next(); // Figure out if it's reachable, and if it MHP itself boolean reachable = false; boolean mhpself = false; { ReachableMethods rm = Scene.v().getReachableMethods(); reachable = rm.contains(tn.method); if(mhp != null) mhpself = mhp.mayHappenInParallel(tn.method, tn.method); } G.v().out.println("[transaction-table] Transaction " + tn.name + (reachable ? " reachable" : " dead") + (mhpself ? " [called from >= 2 threads]" : " [called from <= 1 thread]")); G.v().out.println("[transaction-table] Where: " + tn.method.getDeclaringClass().toString() + ":" + tn.method.toString() + ": "); G.v().out.println("[transaction-table] Orig : " + tn.origLock); G.v().out.println("[transaction-table] Prep : " + tn.prepStmt); G.v().out.println("[transaction-table] Begin: " + tn.entermonitor); G.v().out.print("[transaction-table] End : early:" + tn.earlyEnds.toString() + " exc:" + tn.exceptionalEnd + " through:" + tn.end + " \n"); G.v().out.println("[transaction-table] Size : " + tn.units.size()); if(tn.read.size() < 100) G.v().out.print("[transaction-table] Read : " + tn.read.size() + "\n[transaction-table] " + tn.read.toString().replaceAll("\\[", " : [").replaceAll("\n", "\n[transaction-table] ")); else G.v().out.print("[transaction-table] Read : " + tn.read.size() + " \n[transaction-table] "); if(tn.write.size() < 100) G.v().out.print("Write: " + tn.write.size() + "\n[transaction-table] " + tn.write.toString().replaceAll("\\[", " : [").replaceAll("\n", "\n[transaction-table] ")); // label provided by previous print statement else G.v().out.print("Write: " + tn.write.size() + "\n[transaction-table] "); // label provided by previous print statement G.v().out.print("Edges: (" + tn.edges.size() + ") "); // label provided by previous print statement Iterator<CriticalSectionDataDependency> tnedgeit = tn.edges.iterator(); while(tnedgeit.hasNext()) G.v().out.print(tnedgeit.next().other.name + " "); if(tn.group != null && tn.group.useLocksets) { G.v().out.println("\n[transaction-table] Locks: " + tn.lockset); } else G.v().out.println("\n[transaction-table] Lock : " + (tn.setNumber == -1 ? "-" : (tn.lockObject == null ? "Global" : (tn.lockObject.toString() + (tn.lockObjectArrayIndex == null ? "" : "[" + tn.lockObjectArrayIndex + "]")) ))); G.v().out.println("[transaction-table] Group: " + tn.setNumber + "\n[transaction-table] "); } }