Author: dazarov
Date: 2009-11-12 12:32:26 -0500 (Thu, 12 Nov 2009)
New Revision: 18661
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/RefactorSearcher.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5190
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/RefactorSearcher.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/RefactorSearcher.java 2009-11-12
17:23:35 UTC (rev 18660)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/RefactorSearcher.java 2009-11-12
17:32:26 UTC (rev 18661)
@@ -11,7 +11,6 @@
package org.jboss.tools.common.el.core.refactoring;
import java.io.IOException;
-import java.io.InputStream;
import java.util.List;
import java.util.StringTokenizer;
@@ -82,73 +81,7 @@
protected IJavaElement javaElement;
protected IJavaSearchScope searchScope;
- // performance measure
- private int totalSize = 0;
- private int filesNumber = 0;
- private long startTime = 0;
- private long stopTime = 0;
- private long startMem = 0;
- private long stopMem = 0;
- private boolean log = false;
-
- private void clearHistory(){
- totalSize = 0;
- filesNumber = 0;
- startTime = 0;
- stopTime = 0;
- startMem = 0;
- stopMem = 0;
- }
-
- private void startStatistics(){
- clearHistory();
- startTime = System.currentTimeMillis();
- startMem = Runtime.getRuntime().freeMemory();
- }
-
- private void stopStatistic(){
- stopTime = System.currentTimeMillis();
- stopMem = Runtime.getRuntime().freeMemory();
- printELSearchStatistics();
- }
-
- private void collectStatistic(int fileSize){
- filesNumber++;
- totalSize += fileSize;
- }
-
- private void printELSearchStatistics(){
- if(log){
- System.out.println("EL Search"); //$NON-NLS-1$
- System.out.println("Total files number: "+getFilesNumber()); //$NON-NLS-1$
- System.out.println("Total files size: "+getTotlalFilesSize()+"
Mb"); //$NON-NLS-1$ $NON-NLS-2$
- System.out.println("Memory usage size: "+getTotlalMemorySize()+"
Mb"); //$NON-NLS-1$ $NON-NLS-2$
- System.out.println("Free Memory size: "+getRestMemorySize()+"
Mb"); //$NON-NLS-1$ $NON-NLS-2$
- System.out.println("Total time: "+getTotalTime()+" sec");
//$NON-NLS-1$ $NON-NLS-2$
- }
- }
-
- private double getTotlalFilesSize(){
- return (double)totalSize/(1024*1025);
- }
-
- private double getTotlalMemorySize(){
- return (double)(startMem-stopMem)/(1024*1025);
- }
-
- private double getRestMemorySize(){
- return (double)stopMem/(1024*1025);
- }
-
- private int getFilesNumber(){
- return filesNumber;
- }
-
- private double getTotalTime(){
- return (double)(stopTime - startTime)/1000;
- }
-
public RefactorSearcher(IFile baseFile, String propertyName){
this.baseFile = baseFile;
this.propertyName = propertyName;
@@ -167,7 +100,7 @@
if(baseFile == null)
return;
- startStatistics();
+ //startStatistics();
IProject[] projects = getProjects();
for (IProject project : projects) {
@@ -197,7 +130,7 @@
else
scan(project);
}
- stopStatistic();
+ //stopStatistic();
}
protected void updateEnvironment(IProject project){
@@ -239,7 +172,7 @@
String content = null;
try {
content = FileUtil.readStream(file);
- collectStatistic(content.length());
+ //collectStatistic(content.length());
} catch (CoreException e) {
ELCorePlugin.getDefault().logError(e);
}
@@ -261,7 +194,7 @@
String content = null;
try {
content = FileUtil.readStream(file);
- collectStatistic(content.length());
+ //collectStatistic(content.length());
} catch (CoreException e) {
ELCorePlugin.getDefault().logError(e);
}
@@ -523,4 +456,71 @@
}
}
}
+ // performance measure
+// private int totalSize = 0;
+// private int filesNumber = 0;
+// private long startTime = 0;
+// private long stopTime = 0;
+// private long startMem = 0;
+// private long stopMem = 0;
+//
+// private boolean log = false;
+//
+// private void clearHistory(){
+// totalSize = 0;
+// filesNumber = 0;
+// startTime = 0;
+// stopTime = 0;
+// startMem = 0;
+// stopMem = 0;
+// }
+//
+// private void startStatistics(){
+// clearHistory();
+// startTime = System.currentTimeMillis();
+// startMem = Runtime.getRuntime().freeMemory();
+// }
+//
+// private void stopStatistic(){
+// stopTime = System.currentTimeMillis();
+// stopMem = Runtime.getRuntime().freeMemory();
+// printELSearchStatistics();
+// }
+//
+// private void collectStatistic(int fileSize){
+// filesNumber++;
+// totalSize += fileSize;
+// }
+//
+// private void printELSearchStatistics(){
+// if(log){
+// System.out.println("EL Search"); //$NON-NLS-1$
+// System.out.println("Total files number: "+getFilesNumber());
//$NON-NLS-1$
+// System.out.println("Total files size: "+getTotlalFilesSize()+"
Mb"); //$NON-NLS-1$ $NON-NLS-2$
+// System.out.println("Memory usage size: "+getTotlalMemorySize()+"
Mb"); //$NON-NLS-1$ $NON-NLS-2$
+// System.out.println("Free Memory size: "+getRestMemorySize()+"
Mb"); //$NON-NLS-1$ $NON-NLS-2$
+// System.out.println("Total time: "+getTotalTime()+" sec");
//$NON-NLS-1$ $NON-NLS-2$
+// }
+// }
+//
+// private double getTotlalFilesSize(){
+// return (double)totalSize/(1024*1025);
+// }
+//
+// private double getTotlalMemorySize(){
+// return (double)(startMem-stopMem)/(1024*1025);
+// }
+//
+// private double getRestMemorySize(){
+// return (double)stopMem/(1024*1025);
+// }
+//
+// private int getFilesNumber(){
+// return filesNumber;
+// }
+//
+// private double getTotalTime(){
+// return (double)(stopTime - startTime)/1000;
+// }
+
}
\ No newline at end of file