diff --git a/src/org/ntlab/deltaExtractor/Test.java b/src/org/ntlab/deltaExtractor/Test.java index 019e86a..c8fb35e 100644 --- a/src/org/ntlab/deltaExtractor/Test.java +++ b/src/org/ntlab/deltaExtractor/Test.java @@ -25,25 +25,25 @@ */ public static void main(String[] args) { long time = System.nanoTime(); - TraceJSON trace = new TraceJSON("traces\\sampleCollection.trace"); - DeltaExtractorJSON s = new DeltaExtractorJSON(trace); - HashMap threads = trace.getAllThreads(); - ThreadInstance thread = threads.values().iterator().next(); - TracePoint tp = thread.getRoot().get(thread.getRoot().size() - 1).getExitPoint(); - ExtractedStructure e = s.extract(new Reference(null, null, "sampleCollection.D", "sampleCollection.C"), tp, new IAliasTracker() { - @Override - public void addAlias(Alias alias) { - System.out.println(alias.getAliasType().toString() + ":" + alias.getObjectId() +"," + alias.getIndex() + "," + alias.getMethodSignature() + "," + alias.getLineNo()); - } - @Override - public void changeTrackingObject(String from, String to, boolean isSrcSide) { - System.out.println("Change:" + from + "�@=>�@" + to); - } - @Override - public List getAliasList() { - return null; - } - }); +// TraceJSON trace = new TraceJSON("traces\\sampleCollection.trace"); +// DeltaExtractorJSON s = new DeltaExtractorJSON(trace); +// HashMap threads = trace.getAllThreads(); +// ThreadInstance thread = threads.values().iterator().next(); +// TracePoint tp = thread.getRoot().get(thread.getRoot().size() - 1).getExitPoint(); +// ExtractedStructure e = s.extract(new Reference(null, null, "sampleCollection.D", "sampleCollection.C"), tp, new IAliasTracker() { +// @Override +// public void addAlias(Alias alias) { +// System.out.println(alias.getAliasType().toString() + ":" + alias.getObjectId() +"," + alias.getIndex() + "," + alias.getMethodSignature() + "," + alias.getLineNo()); +// } +// @Override +// public void changeTrackingObject(String from, String to, boolean isSrcSide) { +// System.out.println("Change:" + from + "�@=>�@" + to); +// } +// @Override +// public List getAliasList() { +// return null; +// } +// }); // TraceJSON trace = new TraceJSON("traces\\_finalLocal.trace"); // DeltaExtractorJSON s = new DeltaExtractorJSON(trace); @@ -332,59 +332,136 @@ // } - /////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////// // // - // MagnetRON�p // + // MagnetRON�p // // // - /////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////// -// // --------------- Eclipse JDT (2015/10/31 �A�[�L�e�N�`���������؎��� �ۑ�2) --------------- -// // ��1,2(1st�f���^), �ȉ��̃f���^(���o�Ƃ��Ă�2��) -// DeltaExtractor s = new DeltaExtractor("traces\\eclipse-Debug1.txt"); -// MethodExecution m = null; -// -// System.out.println(System.nanoTime() - time); -// ExtractedStructure e = null; -// do { -// if (m == null) { -// m = s.getLastMethodExecution("public boolean org.eclipse.jdt.internal.debug.core.breakpoints.JavaBreakpoint.handleBreakpointEvent("); -// } else { -// TracePoint nextTp = m.getEntryPoint(); -// nextTp.stepBackOver(); -// m = s.getLastMethodExecution("public boolean org.eclipse.jdt.internal.debug.core.breakpoints.JavaBreakpoint.handleBreakpointEvent(", nextTp); -// } -// if (m != null) { -// ArrayList argments = m.getArguments(); -// for (int i = 0; i < argments.size(); i++) { -// if (argments.get(i).getActualType().equals("org.eclipse.jdi.internal.event.BreakpointEventImpl")) { -// System.out.println(System.nanoTime() - time); -// e = s.extract(m.getEntryPoint(), argments.get(i)); -// break; -// } -// } -// } -// } while (e == null); -// Reference nextTarget = e.getDelta().getDstSide().get(3); // EventDispatcher$1 -> EventSetImpl -// e = s.extract(nextTarget, m.getEntryPoint()); -// System.out.println(System.nanoTime() - time); -// System.out.println("//////////////////////////////////"); -// -// // ��3(2nd�f���^), �ȉ��̃f���^ -// MethodExecution m2 = e.getCoordinator().getChildren().get(21); -// e = s.extract(m2.getExitPoint(), new ObjectReference("859038530", "org.eclipse.jdi.internal.jdwp.JdwpCommandPacket")); -// System.out.println(System.nanoTime() - time); -// System.out.println("//////////////////////////////////"); -// -// -// // ��4(3rd�f���^), �ȉ��̃f���^ + // --------------- Eclipse JDT (2015/10/31 �A�[�L�e�N�`���������؎��� �ۑ�2) --------------- + // 1��ڂ̃f���^���o + // { + // "src": { + // "class": "public boolean org.eclipse.jdt.internal.debug.core.breakpoints.JavaBreakpoint.handleBreakpointEvent(", + // "id": "666051245" + // }, + // "dst": { + // "class": "org.eclipse.jdi.internal.event.BreakpointEventImpl", + // "id": "907205473" + // }, + // "type": "This-Another", + // "order": "0" + // } + DeltaExtractor s = new DeltaExtractor("traces\\eclipse-Debug1.txt"); + MethodExecution m = null; + + System.out.println(System.nanoTime() - time); + ExtractedStructure e = null; + do { + if (m == null) { + m = s.getLastMethodExecution("public boolean org.eclipse.jdt.internal.debug.core.breakpoints.JavaBreakpoint.handleBreakpointEvent("); + } else { + TracePoint nextTp = m.getEntryPoint(); + nextTp.stepBackOver(); + m = s.getLastMethodExecution("public boolean org.eclipse.jdt.internal.debug.core.breakpoints.JavaBreakpoint.handleBreakpointEvent(", nextTp); + } + if (m != null) { + ArrayList argments = m.getArguments(); + for (int i = 0; i < argments.size(); i++) { + if (argments.get(i).getActualType().equals("org.eclipse.jdi.internal.event.BreakpointEventImpl")) { + System.out.println(System.nanoTime() - time); + e = s.extract(m.getEntryPoint(), argments.get(i)); + break; + } + } + } + } while (e == null); + System.out.println(System.nanoTime() - time); + System.out.println("//////////////////////////////////"); + + // 2��ڂ̃f���^���o + // { + // "src": { + // "class": "org.eclipse.jdi.internal.event.EventIteratorImpl", + // "id": "239180057" + // }, + // "dst": { + // "class": "java.util.ArrayList$ListItr", + // "id": "316502076" + // }, + // "type": "Container-Component", + // "order": "0" + // }, + Reference nextTarget = e.getDelta().getDstSide().get(1); // EventIteratorImpl -> ArrayList$ListItr + ExtractedStructure e2 = s.extract(nextTarget, m.getEntryPoint()); + System.out.println(System.nanoTime() - time); + System.out.println("//////////////////////////////////"); + + // 3��ڂ̃f���^���o + // { + // "src": { + // "class": "java.util.ArrayList", + // "id": "1121573201" + // }, + // "dst": { + // "class": "org.eclipse.jdi.internal.event.BreakpointEventImpl", + // "id": "907205473" + // }, + // "type": "Container-Component(Collection)", + // "order": "0" + // }, + Reference nextnextTarget = new Reference("1121573201", "907205473", null, null); // ArrayList -> BreakpointEventImpl + nextnextTarget.setCollection(true); + e2 = s.extract(nextnextTarget, m.getEntryPoint()); + System.out.println(System.nanoTime() - time); + System.out.println("//////////////////////////////////"); + + // 4��ڂ̃f���^���o + // { + // "src": { + // "class": "public void org.eclipse.jdt.internal.debug.core.EventDispatcher.run(", + // "id": "629542817" + // }, + // "dst": { + // "class": "org.eclipse.jdi.internal.event.EventSetImpl", + // "id": "1400795012" + // }, + // "type": "This-Another", + // "order": "0" + // }, + Reference nextnextnextTarget = e.getDelta().getDstSide().get(3); // EventDispatcher$1 -> EventSetImpl + e2 = s.extract(nextnextnextTarget, m.getEntryPoint()); + System.out.println(System.nanoTime() - time); + System.out.println("//////////////////////////////////"); + + // 5��ڂ̃f���^���o + // { + // "src": { + // "class": "public com.sun.jdi.event.EventSet org.eclipse.jdi.internal.event.EventQueueImpl.remove(", + // "id": null + // }, + // "dst": { + // "class": "org.eclipse.jdi.internal.jdwp.JdwpCommandPacket", + // "id": "859038530" + // }, + // "type": "This-Another", + // "order": "0" + // } + MethodExecution m2 = e2.getCoordinator().getChildren().get(21); + e2 = s.extract(m2.getExitPoint(), new ObjectReference("859038530", "org.eclipse.jdi.internal.jdwp.JdwpCommandPacket")); + System.out.println(System.nanoTime() - time); + System.out.println("//////////////////////////////////"); + + +// // 6��ڂ̃f���^���o(�ۑ�ɂ͊܂߂Ȃ�) // m = e.getCoordinator().getChildren().get(0).getChildren().get(1).getChildren().get(4); // Reference lastTarget = new Reference(e.getDelta().getDstSide().get(1).getSrcObject(), e.getDelta().getDstSide().get(0).getDstObject()); // lastTarget.setCollection(true); // e = s.extract(lastTarget, m.getExitPoint()); - - System.out.println(System.nanoTime() - time); - System.out.println("//////////////////////////////////"); +// System.out.println(System.nanoTime() - time); +// System.out.println("//////////////////////////////////"); + // // s.extractArg(e.getCoodinator(), 123456789); // // s.getCallHistory(e.getCoodinator());