Author: dgeraskov
Date: 2008-01-28 10:13:01 -0500 (Mon, 28 Jan 2008)
New Revision: 5994
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/AbstractQueryPage.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/HQLQueryPage.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/JavaPage.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/QueryPage.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1695
added Query run time property
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/AbstractQueryPage.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/AbstractQueryPage.java 2008-01-28
15:09:40 UTC (rev 5993)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/AbstractQueryPage.java 2008-01-28
15:13:01 UTC (rev 5994)
@@ -40,6 +40,7 @@
private Session session;
private final ConsoleConfiguration cfg;
protected List list;
+ protected long queryTime = -1; //shows how long query runs
List pathNames;
protected boolean sticky = true;
private List exceptions = new ArrayList();
@@ -139,4 +140,8 @@
public ConsoleConfiguration getConsoleConfiguration() {
return cfg;
}
+
+ public long getQueryTime(){
+ return queryTime;
+ }
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/HQLQueryPage.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/HQLQueryPage.java 2008-01-28
15:09:40 UTC (rev 5993)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/HQLQueryPage.java 2008-01-28
15:13:01 UTC (rev 5994)
@@ -46,7 +46,9 @@
//list = query.list();
list = new ArrayList();
setupParameters(query, model);
+ long startTime = System.currentTimeMillis();
Iterator iter = query.list().iterator(); // need to be user-controllable to toggle
between iterate, scroll etc.
+ queryTime = System.currentTimeMillis() - startTime;
while (iter.hasNext() ) {
Object element = iter.next();
list.add(element);
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/JavaPage.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/JavaPage.java 2008-01-28
15:09:40 UTC (rev 5993)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/JavaPage.java 2008-01-28
15:13:01 UTC (rev 5994)
@@ -123,7 +123,9 @@
if(list!=null) return list;
try {
if(criteria!=null) {
+ long startTime = System.currentTimeMillis();
list = criteria.list();
+ queryTime = System.currentTimeMillis() - startTime;
}
else {
return Collections.EMPTY_LIST;
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/QueryPage.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/QueryPage.java 2008-01-28
15:09:40 UTC (rev 5993)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/QueryPage.java 2008-01-28
15:13:01 UTC (rev 5994)
@@ -31,6 +31,11 @@
*
*/
public interface QueryPage {
+ /**
+ * Returns query run time in milliseconds
+ * @return
+ */
+ public abstract long getQueryTime();
public abstract List getList();
/**