diff --git a/org.ntlab.sampleAnalyzer/log.csv b/org.ntlab.sampleAnalyzer/log.csv
new file mode 100644
index 0000000..e2600a8
--- /dev/null
+++ b/org.ntlab.sampleAnalyzer/log.csv
@@ -0,0 +1,39 @@
+!SESSION 2018-09-25 12:48:51.296 -----------------------------------------------
+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.egit.ui 2 0 2018-09-25 12:49:12.415
+!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-25 12:49:12.415
+!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/ObjectFlowTest2/bin:A
+C:/Users/student/runtime-EclipseApplication/ObjectFlowTest2/bin:B
+C:/Users/student/runtime-EclipseApplication/ObjectFlowTest2/bin:Main
+classpath[0] = C:\Users\student\runtime-EclipseApplication\ObjectFlowTest2\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\
+classpath[4] = C:\Users\student\Downloads\eclipse-rcp-luna-SR2-win32-x86_64\eclipse\..\..\..\git\org.ntlab.sampleAnalyzer\org.ntlab.sampleAnalyzer\bin\
+Main (4):org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget@adabe38SampleAnalyzer OK!
+targetSignature: public B Main.getB()
+Exp (Target),45171289
+Main (4):org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget@adabe38SampleAnalyzer OK!
+targetSignature: public B Main.getB()
+Exp (Target),2762511
+Main (4):org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget@adabe38SampleAnalyzer OK!
+targetSignature: public B Main.getB()
+Exp (Target),2548553
diff --git a/org.ntlab.sampleAnalyzer/plugin.xml b/org.ntlab.sampleAnalyzer/plugin.xml
index d605104..ea09a21 100644
--- a/org.ntlab.sampleAnalyzer/plugin.xml
+++ b/org.ntlab.sampleAnalyzer/plugin.xml
@@ -7,5 +7,20 @@
class="org.ntlab.sampleanalyzer.analyzerProvider.SampleAnalyzerLaunchConfiguration">
+
+
+
+
+
+
diff --git a/org.ntlab.sampleAnalyzer/src/org/ntlab/onlineAccessor/JDIDebuggingVirtualMachine.java b/org.ntlab.sampleAnalyzer/src/org/ntlab/onlineAccessor/JDIDebuggingVirtualMachine.java
index a94fd82..6786e5f 100644
--- a/org.ntlab.sampleAnalyzer/src/org/ntlab/onlineAccessor/JDIDebuggingVirtualMachine.java
+++ b/org.ntlab.sampleAnalyzer/src/org/ntlab/onlineAccessor/JDIDebuggingVirtualMachine.java
@@ -9,7 +9,7 @@
public class JDIDebuggingVirtualMachine {
- public static VirtualMachine getDebuggineVirtualMachine()
+ public static VirtualMachine getDebuggingVirtualMachine()
throws NotExecutedException, NotSuspendedException, NotDebuggedException {
LaunchManager lm = (LaunchManager)DebugPlugin.getDefault().getLaunchManager();
ILaunch[] launches = lm.getLaunches();
diff --git a/org.ntlab.sampleAnalyzer/src/org/ntlab/sampleanalyzer/SampleAnalyzeAction.java b/org.ntlab.sampleAnalyzer/src/org/ntlab/sampleanalyzer/SampleAnalyzeAction.java
new file mode 100644
index 0000000..297cda6
--- /dev/null
+++ b/org.ntlab.sampleAnalyzer/src/org/ntlab/sampleanalyzer/SampleAnalyzeAction.java
@@ -0,0 +1,161 @@
+package org.ntlab.sampleanalyzer;
+
+import java.util.List;
+
+import org.eclipse.jdt.core.dom.Message;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.ntlab.onlineAccessor.JDIDebuggingVirtualMachine;
+import org.ntlab.onlineAccessor.JDIInstanceMethodCaller;
+import org.ntlab.onlineAccessor.NotDebuggedException;
+import org.ntlab.onlineAccessor.NotExecutedException;
+import org.ntlab.onlineAccessor.NotSuspendedException;
+import org.ntlab.sampleanalyzer.analyzerProvider.SampleAnalyzerLaunchConfiguration;
+
+import com.sun.jdi.ClassNotLoadedException;
+import com.sun.jdi.IncompatibleThreadStateException;
+import com.sun.jdi.IntegerValue;
+import com.sun.jdi.InvalidTypeException;
+import com.sun.jdi.InvocationException;
+import com.sun.jdi.ObjectReference;
+import com.sun.jdi.StringReference;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.VirtualMachine;
+
+public class SampleAnalyzeAction implements IWorkbenchWindowActionDelegate {
+
+ @Override
+ public void run(IAction arg0) {
+ try {
+ VirtualMachine vm = JDIDebuggingVirtualMachine.getDebuggingVirtualMachine();
+ List allThreads = vm.allThreads();
+ for (int i = 0; i < allThreads.size(); i++) {
+ ThreadReference thread = allThreads.get(i);
+ if (thread.isSuspended()) {
+ System.out.println("SampleAnalyzer OK!");
+ countMethodExecutionTest(vm, thread);
+ }
+ }
+ } catch (NotExecutedException | NotSuspendedException | NotDebuggedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void selectionChanged(IAction arg0, ISelection arg1) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void dispose() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void init(IWorkbenchWindow arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void countMethodExecutionTest(VirtualMachine vm, ThreadReference thread) {
+ JDIInstanceMethodCaller mc = new JDIInstanceMethodCaller(vm, thread, null);
+ try {
+ StringReference threadId = mc.getVm().mirrorOf(String.valueOf(mc.getThreadId()));
+ ObjectReference threadInstance = (ObjectReference)mc.callStaticMethod(SampleAnalyzerLaunchConfiguration.TRACE, "TraceJSON", "getThreadInstance", threadId);
+ ObjectReference roots = (ObjectReference)mc.changeReceiver(threadInstance).callInstanceMethod("getRoot");
+ ObjectReference currentMe = (ObjectReference)mc.callInstanceMethod("getCurrentMethodExecution");
+ String targetSignature = ((StringReference)mc.changeReceiver(currentMe).callInstanceMethod("getSignature")).value();
+
+ System.out.println("targetSignature: " + targetSignature);
+// test(mc, roots, targetSignature, SpeedTestType.ANALYZER); // �ꎟ��͂��A�i���C�U���ōs��
+ test(mc, roots, targetSignature, SpeedTestType.TARGET); // �ꎟ��͂�Ώۃv���O�������ōs��
+ } catch (InvalidTypeException | ClassNotLoadedException
+ | InvocationException | IncompatibleThreadStateException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private void test(JDIInstanceMethodCaller mc, ObjectReference roots, String targetSignature, SpeedTestType type)
+ throws InvalidTypeException, ClassNotLoadedException, InvocationException, IncompatibleThreadStateException {
+ int count = 0;
+ long beforeTime = 0, afterTime = 0;
+ mc.changeReceiver(roots);
+ switch (type) {
+ case ANALYZER:
+ beforeTime = System.nanoTime();
+ count = countMethodExecutionInAnalyzer(mc, targetSignature, 0, "--------");
+ afterTime = System.nanoTime();
+ break;
+ case TARGET:
+ beforeTime = System.nanoTime();
+ count = countMethodExecutionInTarget(mc, targetSignature, 0, "--------");
+ afterTime = System.nanoTime();
+ break;
+ }
+ long executionTime = afterTime - beforeTime;
+ System.out.println("Exp " + "(" + type.getTypeName() + ")," + executionTime);
+ StringBuilder result = new StringBuilder();
+ String lineSeparator = System.lineSeparator();
+ String title = "Sample Analyze Result";
+ result.append(title); result.append(lineSeparator);
+ result.append("(executed within " + type.getTypeName() + ")"); result.append(lineSeparator);
+ result.append(System.lineSeparator());
+ result.append("signature: " + targetSignature); result.append(lineSeparator);
+ result.append("count: " + count); result.append(lineSeparator);
+ result.append("time: " + executionTime + " nsec"); result.append(lineSeparator);
+ MessageDialog.openInformation(null, title, result.toString());
+ }
+
+ private int countMethodExecutionInTarget(JDIInstanceMethodCaller mc, String targetSignture, int count, String indent)
+ throws InvalidTypeException, ClassNotLoadedException, InvocationException, IncompatibleThreadStateException {
+ VirtualMachine vm = mc.getVm();
+ String methodName = "countMethodExecution";
+ return ((IntegerValue)mc.callStaticMethod(SampleAnalyzerLaunchConfiguration.ANALYZER_PACKAGE, SampleAnalyzerLaunchConfiguration.ANALYZER_CLASS, methodName,
+ mc.getReceiver(), vm.mirrorOf(targetSignture), vm.mirrorOf(count), vm.mirrorOf(indent))).value();
+ }
+
+ private int countMethodExecutionInAnalyzer(JDIInstanceMethodCaller mc, String targetSignature, int count, String indent)
+ throws InvalidTypeException, ClassNotLoadedException, InvocationException, IncompatibleThreadStateException {
+ VirtualMachine vm = mc.getVm();
+ ObjectReference methodExecutions = mc.getReceiver();
+ if (methodExecutions == null) {
+ return count;
+ }
+ int methodExecutionsSize = ((IntegerValue)mc.callInstanceMethod("size")).value();
+ if (methodExecutionsSize == 0) {
+ return count;
+ }
+ for (int i = 0; i < methodExecutionsSize; i++) {
+ IntegerValue index = vm.mirrorOf(i);
+ ObjectReference methodExecution = (ObjectReference)mc.changeReceiver(methodExecutions).callInstanceMethod("get", index);
+ String signature = ((StringReference)mc.changeReceiver(methodExecution).callInstanceMethod("getSignature")).value();
+// System.out.println(indent + signature);
+ if (targetSignature.equals(signature)) {
+ count++;
+ }
+ ObjectReference children = (ObjectReference)mc.callInstanceMethod("getChildren");
+ count = countMethodExecutionInAnalyzer(mc.changeReceiver(children), targetSignature, count, indent + "--------");
+ }
+ return count;
+ }
+
+ private enum SpeedTestType {
+ ANALYZER, TARGET;
+
+ public String getTypeName() {
+ switch (this) {
+ case ANALYZER:
+ return "analyzer";
+ case TARGET:
+ return "target";
+ default:
+ return "";
+ }
+ }
+ }
+}
diff --git a/org.ntlab.sampleAnalyzer/src/org/ntlab/sampleanalyzer/analyzerProvider/SampleAnalyzer.java b/org.ntlab.sampleAnalyzer/src/org/ntlab/sampleanalyzer/analyzerProvider/SampleAnalyzer.java
new file mode 100644
index 0000000..bcf6039
--- /dev/null
+++ b/org.ntlab.sampleAnalyzer/src/org/ntlab/sampleanalyzer/analyzerProvider/SampleAnalyzer.java
@@ -0,0 +1,25 @@
+package org.ntlab.sampleanalyzer.analyzerProvider;
+
+import java.util.List;
+
+import org.ntlab.traceCollector.tracer.trace.MethodExecution;
+
+public class SampleAnalyzer {
+ public static int countMethodExecution(List methodExecutions,
+ String targetSignature, int count, String indent) {
+ if (methodExecutions == null || methodExecutions.isEmpty()) {
+ return count;
+ }
+ for (int i = 0; i < methodExecutions.size(); i++) {
+ MethodExecution me = methodExecutions.get(i);
+ String signature = me.getSignature();
+// System.out.println(indent + signature);
+ if (targetSignature.equals(signature)) {
+ count++;
+ }
+ List children = me.getChildren();
+ count = countMethodExecution(children, targetSignature, count, indent + "--------");
+ }
+ return count;
+ }
+}
diff --git a/org.ntlab.sampleAnalyzer/src/org/ntlab/sampleanalyzer/analyzerProvider/SampleAnalyzerLaunchConfiguration.java b/org.ntlab.sampleAnalyzer/src/org/ntlab/sampleanalyzer/analyzerProvider/SampleAnalyzerLaunchConfiguration.java
index 6dc7f0a..9afad9e 100644
--- a/org.ntlab.sampleAnalyzer/src/org/ntlab/sampleanalyzer/analyzerProvider/SampleAnalyzerLaunchConfiguration.java
+++ b/org.ntlab.sampleAnalyzer/src/org/ntlab/sampleanalyzer/analyzerProvider/SampleAnalyzerLaunchConfiguration.java
@@ -8,7 +8,10 @@
import org.ntlab.traceCollector.IAdditionalLaunchConfiguration;
public class SampleAnalyzerLaunchConfiguration implements IAdditionalLaunchConfiguration {
- public static final String ANALYZER_PATH = "org/ntlab/sampleanalyzer/analyzerProvider/SampleAnalyzerLaunchConfiguration.class";
+ public static final String ANALYZER_PATH = "org/ntlab/sampleanalyzer/analyzerProvider/SampleAnalyzer.class";
+ public static final String ANALYZER_PACKAGE = "org.ntlab.sampleanalyzer.analyzerProvider";
+ public static final String ANALYZER_CLASS = "SampleAnalyzer";
+ public static final String TRACE = "org.ntlab.traceCollector.tracer.trace";
@Override
public String[] getAdditionalClasspath() {