diff --git a/org.ntlab.reverseDebugger/.settings/org.eclipse.jdt.core.prefs b/org.ntlab.reverseDebugger/.settings/org.eclipse.jdt.core.prefs index 11f6e46..980b98c 100644 --- a/org.ntlab.reverseDebugger/.settings/org.eclipse.jdt.core.prefs +++ b/org.ntlab.reverseDebugger/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,12 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.source=1.7 diff --git a/org.ntlab.reverseDebugger/speedResult.csv b/org.ntlab.reverseDebugger/speedResult.csv index 6c3b74b..06a88c1 100644 --- a/org.ntlab.reverseDebugger/speedResult.csv +++ b/org.ntlab.reverseDebugger/speedResult.csv @@ -1,16 +1,64 @@ -ReverseDebugger,,,TraceCollector,,, -No,Time(nsec),,No,Time(nsec),, -1,59422911,,1,27624371,, -2,37320415,,2,4140222,, -3,40346629,,3,3751780,, -4,28439941,,4,3046742,, -5,28923124,,5,3113061,, -6,35115296,,6,4244437,, -7,28169137,,7,3323073,, -8,32749907,,8,3298597,, -9,26405358,,9,3259122,, -10,25948229,,10,3725726,, -Best,25948229,,Best,3046742,, -Worst,59422911,,Worst,27624371,, -Ave(1~10),34284094,,Ave(1~10),5952713,, -Ave(2~10),31490892,,Ave(2~10),3544751,, \ No newline at end of file +!SESSION 2018-09-21 14:34:47.545 ----------------------------------------------- +eclipse.buildId=4.4.2.M20150204-1700 +java.version=1.8.0_144 +java.vendor=Oracle Corporation +BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=ja_JP +Framework arguments: -product org.eclipse.platform.ide +Command-line arguments: -product org.eclipse.platform.ide -data C:\Users\student\workspace/../runtime-EclipseApplication -dev file:C:/Users/student/workspace/.metadata/.plugins/org.eclipse.pde.core/Eclipse Application/dev.properties -os win32 -ws win32 -arch x86_64 -consoleLog + +!ENTRY org.eclipse.core.resources 2 10035 2018-09-21 14:34:50.118 +!MESSAGE The workspace exited with unsaved changes in the previous session; refreshing workspace to recover changes. + +!ENTRY org.eclipse.egit.ui 2 0 2018-09-21 14:35:00.050 +!MESSAGE Warning: EGit couldn't detect the installation path "gitPrefix" of native Git. Hence EGit can't respect system level +Git settings which might be configured in ${gitPrefix}/etc/gitconfig under the native Git installation directory. +The most important of these settings is core.autocrlf. Git for Windows by default sets this parameter to true in +this system level configuration. The Git installation location can be configured on the +Team > Git > Configuration preference page's 'System Settings' tab. +This warning can be switched off on the Team > Git > Confirmations and Warnings preference page. + +!ENTRY org.eclipse.egit.ui 2 0 2018-09-21 14:35:00.066 +!MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git +user global configuration and to define the default location to store repositories: 'C:\Users\student'. If this is +not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and +EGit might behave differently since they see different configuration options. +This warning can be switched off on the Team > Git > Confirmations and Warnings preference page. +C:/Users/student/runtime-EclipseApplication/ObjectFlowTest/bin:Account +C:/Users/student/runtime-EclipseApplication/ObjectFlowTest/bin:Bank +C:/Users/student/runtime-EclipseApplication/ObjectFlowTest/bin:Company +C:/Users/student/runtime-EclipseApplication/ObjectFlowTest/bin:Main +C:/Users/student/runtime-EclipseApplication/ObjectFlowTest/bin:Money +C:/Users/student/runtime-EclipseApplication/ObjectFlowTest/bin:Person +C:/Users/student/runtime-EclipseApplication/ObjectFlowTest/bin:Stream +classpath[0] = C:\Users\student\runtime-EclipseApplication\ObjectFlowTest\bin +classpath[1] = C:\Users\student\Downloads\eclipse-rcp-luna-SR2-win32-x86_64\eclipse\..\..\..\git\org.ntlab.traceCollector\org.ntlab.traceCollector\bin\ +classpath[2] = C:\Users\student\Downloads\eclipse-rcp-luna-SR2-win32-x86_64\eclipse\..\..\..\git\org.ntlab.traceCollector\org.ntlab.traceCollector\javassist.jar +classpath[3] = C:\Users\student\Downloads\eclipse-rcp-luna-SR2-win32-x86_64\eclipse\..\..\..\git\org.ntlab.reverseDebugger\org.ntlab.reverseDebugger\bin\ +Main (2):org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget@3ed15147 +threadId = "1" +targetSignature: void Stream.print(Account) + +ReverseDebugger: +Exp (RD),36943787 +Exp (RD),26401389 +Exp (RD),25245539 +Exp (RD),18481762 +Exp (RD),21961946 +Exp (RD),24472604 +Exp (RD),22119848 +Exp (RD),19258645 +Exp (RD),25412917 +Exp (RD),20806885 + +TraceCollector: +Exp (TC),27179852 +Exp (TC),2595136 +Exp (TC),2990684 +Exp (TC),2403285 +Exp (TC),2804359 +Exp (TC),2524870 +Exp (TC),2853308 +Exp (TC),3163588 +Exp (TC),3174641 +Exp (TC),3058582 + diff --git a/org.ntlab.reverseDebugger/src/org/ntlab/debuggingControl/MethodCaller.java b/org.ntlab.reverseDebugger/src/org/ntlab/debuggingControl/MethodCaller.java index 39930d4..3e9e5cf 100644 --- a/org.ntlab.reverseDebugger/src/org/ntlab/debuggingControl/MethodCaller.java +++ b/org.ntlab.reverseDebugger/src/org/ntlab/debuggingControl/MethodCaller.java @@ -78,8 +78,8 @@ String fqcn = packageName + "." + className; List classes = vm.classesByName(fqcn); // �N���X�� (���S����N���X��) - // ���Y�N���X���^�[�Q�b�gVM��Ń��[�h����Ă��Ȃ��ꍇ��, JDI��p���ă^�[�Q�b�gVM��Ń��t���N�V�����ɂ�铖�Y�N���X�̃��[�h�����s���� - if (classes.size() == 0) { + // ���Y�N���X���^�[�Q�b�gVM��Ń��[�h����Ă��Ȃ��ꍇ��, JDI��p���ă^�[�Q�b�gJVM��Ń��t���N�V�����ɂ�铖�Y�N���X�̃��[�h�����s���� + if (classes.isEmpty()) { List list = vm.classesByName("java.lang.Class"); ClassType type = (ClassType)list.get(0); List methodsByName = type.methodsByName("forName"); diff --git a/org.ntlab.reverseDebugger/src/org/ntlab/debuggingControl/SpeedTester.java b/org.ntlab.reverseDebugger/src/org/ntlab/debuggingControl/SpeedTester.java index 6de2fbe..44be243 100644 --- a/org.ntlab.reverseDebugger/src/org/ntlab/debuggingControl/SpeedTester.java +++ b/org.ntlab.reverseDebugger/src/org/ntlab/debuggingControl/SpeedTester.java @@ -1,13 +1,5 @@ package org.ntlab.debuggingControl; -import java.io.BufferedWriter; -import java.io.FileWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - import com.sun.jdi.ClassNotLoadedException; import com.sun.jdi.IncompatibleThreadStateException; import com.sun.jdi.IntegerValue; @@ -37,24 +29,21 @@ // �ꎟ��͂̒T��������, ReverseDebugger���ɍ쐬�����ꍇ�ł̏������Ԍv�� System.out.println(); System.out.println("ReverseDebugger:"); - SpeedResult rdResult = test(mc, roots, targetSignature, SpeedTestType.REVERSE_DEBUGGER, LOOP); + test(mc, roots, targetSignature, SpeedTestType.REVERSE_DEBUGGER, LOOP); // �ꎟ��͂̒T��������, �^�[�Q�b�g�v���O�����ɖ��ߍ���TraceCollector���ɍ쐬�����ꍇ�ł̏������Ԍv�� System.out.println(); System.out.println("TraceCollector:"); - SpeedResult tcResult = test(mc, roots, targetSignature, SpeedTestType.TRACE_COLLECTOR, LOOP); - - writeToCSV(rdResult, tcResult); + test(mc, roots, targetSignature, SpeedTestType.TRACE_COLLECTOR, LOOP); } catch (InvalidTypeException | ClassNotLoadedException | InvocationException | IncompatibleThreadStateException e) { e.printStackTrace(); } } - private SpeedResult test(MethodCaller mc, ObjectReference roots, String targetSignature, SpeedTestType type, final int LOOP) + private void test(MethodCaller mc, ObjectReference roots, String targetSignature, SpeedTestType type, final int LOOP) throws InvalidTypeException, ClassNotLoadedException, InvocationException, IncompatibleThreadStateException { int count = 0; - long beforeTime = 0, afterTime = 0, executionTime, sumTime = 0, bestTime = -1, worstTime = -1; - SpeedResult result = new SpeedResult(type); + long beforeTime = 0, afterTime = 0; for (int i = 0; i < LOOP; i++) { mc.setObj(roots); switch (type) { @@ -68,21 +57,9 @@ count = countMethodExecutionInTraceCollector(mc, targetSignature, 0, "--------"); afterTime = System.nanoTime(); break; - } - executionTime = afterTime - beforeTime; - System.out.print("count: " + count + " "); - System.out.println(String.format("Time%-2d: %10d nsec", (i + 1), executionTime)); - sumTime += (executionTime); - bestTime = (bestTime < 0 || executionTime < bestTime) ? executionTime : bestTime; - worstTime = (worstTime < 0 || executionTime > worstTime) ? executionTime : worstTime; - result.addExecutionTime(executionTime); - result.setBestTime(bestTime); - result.setWorstTime(worstTime); + } + System.out.println("Exp " + "(" + type.getTypeName() + ")," + (afterTime - beforeTime)); } - System.out.println(String.format("%-12s: %10d nsec", "BestTime", bestTime)); - System.out.println(String.format("%-12s: %10d nsec", "WorstTime", worstTime)); - System.out.println(String.format("%-12s: %10d nsec", "AverageTime", (sumTime / LOOP))); - return result; } private int countMethodExecutionInTraceCollector(MethodCaller mc, String targetSignture, int count, String indent) @@ -119,119 +96,19 @@ } return count; } - - private void writeToCSV(SpeedResult... results) { - if (results.length == 0) { - return; - } - String path = "C:\\Users\\student\\git\\org.ntlab.reverseDebugger\\org.ntlab.reverseDebugger\\speedResult.csv"; - try (BufferedWriter bw = new BufferedWriter(new FileWriter(path))) { - for (SpeedResult result : results) { - bw.write(result.getSpeedTypeName() + ",,,"); - } - bw.newLine(); - for (int i = 0; i < results.length; i++) { - bw.write("No,Time(nsec),,"); - } - bw.newLine(); - for (int i = 0; i < results[0].getExecutionTimes().size(); i++) { - for (SpeedResult result : results) { - bw.write((i + 1) + "," + result.getExecutionTimes().get(i) + ",,"); - } - bw.newLine(); - } - for (SpeedResult result : results) { - bw.write("Best," + result.getBestTime() + ",,"); - } - bw.newLine(); - for (SpeedResult result : results) { - bw.write("Worst," + result.getWorstTime() + ",,"); - } - bw.newLine(); - for (SpeedResult result : results) { - bw.write("Ave(" + "1~" + result.getExecutionTimeCount() + ")," + result.getAverageTime() + ",,"); - } - bw.newLine(); - for (SpeedResult result : results) { - bw.write("Ave(" + "2~" + result.getExecutionTimeCount() + ")," + result.getAverageTime(1) + ",,"); - } - bw.flush(); - } catch (IOException e) { - e.printStackTrace(); - } - } - + private enum SpeedTestType { REVERSE_DEBUGGER, TRACE_COLLECTOR; - public String getSpeedTypeName() { + public String getTypeName() { switch (this) { case REVERSE_DEBUGGER: - return "ReverseDebugger"; + return "RD"; case TRACE_COLLECTOR: - return "TraceCollector"; + return "TC"; default: return ""; } } - } - - private static class SpeedResult { - private SpeedTestType type; - private List executionTimes = new ArrayList<>(); - private long bestTime; - private long worstTime; - - public SpeedResult(SpeedTestType type) { - this.type = type; - } - - public String getSpeedTypeName() { - return type.getSpeedTypeName(); - } - - public List getExecutionTimes() { - return executionTimes; - } - - public int getExecutionTimeCount() { - return executionTimes.size(); - } - - public long getBestTime() { - return bestTime; - } - - public long getWorstTime() { - return worstTime; - } - - public long getAverageTime() { - return getAverageTime(0, executionTimes.size() - 1); - } - - public long getAverageTime(int start) { - return getAverageTime(start, executionTimes.size() - 1); - } - - public long getAverageTime(int start, int end) { - long sum = 0; - for (int i = start; i <= end; i++) { - sum += executionTimes.get(i); - } - return sum / (end - start + 1); - } - - public void addExecutionTime(long executionTime) { - executionTimes.add(executionTime); - } - - public void setBestTime(long bestTime) { - this.bestTime = bestTime; - } - - public void setWorstTime(long worstTime) { - this.worstTime = worstTime; - } - } + } }