portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r331647 - in /portals/jetspeed-2/trunk: applications/pam/src/java/org/apache/jetspeed/portlets/statistics/ applications/pam/src/webapp/WEB-INF/view/statistics/ components/statistics/src/java/org/apache/jetspeed/statistics/impl/ jetspeed-api...
Date Mon, 07 Nov 2005 23:56:06 GMT
Author: taylor
Date: Mon Nov  7 15:55:54 2005
New Revision: 331647

URL: http://svn.apache.org/viewcvs?rev=331647&view=rev
Log:
http://issues.apache.org/jira/browse/JS2-362
removed the dread non-standard stddev from SQL queries
updated velocity layout, changed float formatting.

Modified:
    portals/jetspeed-2/trunk/applications/pam/src/java/org/apache/jetspeed/portlets/statistics/StatisticsPortlet.java
    portals/jetspeed-2/trunk/applications/pam/src/webapp/WEB-INF/view/statistics/statistics.vm
    portals/jetspeed-2/trunk/components/statistics/src/java/org/apache/jetspeed/statistics/impl/AggregateStatisticsImpl.java
    portals/jetspeed-2/trunk/components/statistics/src/java/org/apache/jetspeed/statistics/impl/PortalStatisticsImpl.java
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/statistics/AggregateStatistics.java

Modified: portals/jetspeed-2/trunk/applications/pam/src/java/org/apache/jetspeed/portlets/statistics/StatisticsPortlet.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/pam/src/java/org/apache/jetspeed/portlets/statistics/StatisticsPortlet.java?rev=331647&r1=331646&r2=331647&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/applications/pam/src/java/org/apache/jetspeed/portlets/statistics/StatisticsPortlet.java
(original)
+++ portals/jetspeed-2/trunk/applications/pam/src/java/org/apache/jetspeed/portlets/statistics/StatisticsPortlet.java
Mon Nov  7 15:55:54 2005
@@ -77,11 +77,12 @@
                 // if we get here, we're on the first startup.
                 sqc = new StatisticsQueryCriteriaImpl();
                 sqc.setQueryType("portlets");
-                sqc.setTimePeriod("all");
+                sqc.setTimePeriod("1");
                 session.setAttribute(SESSION_CRITERIA, sqc);
 
                 try
                 {
+                    statistics.forceFlush();
                     stats = statistics.queryStatistics(sqc);
                 } catch (InvalidCriteriaException e)
                 {
@@ -117,6 +118,7 @@
         AggregateStatistics stats = new AggregateStatisticsImpl();
         try
         {
+            statistics.forceFlush();
             stats = statistics.queryStatistics(criteria);
         } catch (InvalidCriteriaException e)
         {

Modified: portals/jetspeed-2/trunk/applications/pam/src/webapp/WEB-INF/view/statistics/statistics.vm
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/pam/src/webapp/WEB-INF/view/statistics/statistics.vm?rev=331647&r1=331646&r2=331647&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/applications/pam/src/webapp/WEB-INF/view/statistics/statistics.vm
(original)
+++ portals/jetspeed-2/trunk/applications/pam/src/webapp/WEB-INF/view/statistics/statistics.vm
Mon Nov  7 15:55:54 2005
@@ -4,13 +4,13 @@
 	<form name="criteriaForm" action="$renderResponse.createActionURL()" method="post"
 	<table>
 	<tr><td align="center">
-	total sessions in progress: $!results.totalsessions
+	total sessions in progress: $!totalsessions
 	</td></tr>
 	<tr><td>
 	<table class=""portlet-section-body">
-	<tr  class="portlet-section-body"><th>
-	 statistics <br>are for
-	 </hd></tr>
+	<tr  class="portlet-section-subheader"><th>
+	 statistics are for
+	 </hr></tr>
 	 <tr class="portlet-section-alternate"><td>
 	 <SELECT name="queryType" onChange="criteriaForm.submit();">
 	 <OPTION 
@@ -37,7 +37,7 @@
 	 </td><td>
  
 	 <table class=""portlet-section-body">
-	 <tr class="portlet-section-body"><th colspan="2" align="center" >filter on
time periods </th></tr>
+	 <tr class="portlet-section-subheader"><th colspan="2" align="center" >for time
periods </th></tr>
 	 <tr class="portlet-section-alternate"><td>
 	 		<input type="radio" name="timeperiod" value="1" onclick="criteriaForm.submit();"
 	 			#if($criteria.timePeriod == "1")
@@ -106,31 +106,37 @@
 	 
 	</td></tr>
 	</table>
-	</form>
 	<table><tr><td>
 	<table class="class="portlet-section-body" >
-	<tr class="portlet-section-body"><TH><b>stat name</b></TH><TH><b>value</b></TH></TR>
-	<tr class="portlet-section-alternate"><TD>total hits</TD><TD>$!results.hitCount</TD></TR>
-	<tr class="portlet-section-body"><TD>max processing time</TD><TD>$!results.maxProcessingTime</TD></TR>
-	<tr class="portlet-section-alternate"><TD>avg processing time</TD><TD>$!results.avgProcessingTime</TD></TR>
-	<tr class="portlet-section-body"><TD>stdev from avg time</TD><TD>$!results.stdDevProcessingTime</TD></TR>
-	<tr class="portlet-section-alternate"><TD>min processing time</TD><TD>$!results.minProcessingTime</TD></TR>
+	<tr class="portlet-section-subheader"><TH><b>stat name</b></TH><TH><b
align="right" >value</b></TH></TR>
+	<tr class="portlet-section-alternate"><TD>total hits</TD><TD align="right"
>$!results.hitCount</TD></TR>
+	<tr class="portlet-section-body"><TD>max processing time</TD><TD align="right"
>$!results.maxProcessingTime</TD></TR>
+	<tr class="portlet-section-alternate"><TD>avg processing time</TD><TD
align="right" >$!results.avgProcessingTime</TD></TR>
+	<tr class="portlet-section-body"><TD>min processing time</TD><TD align="right"
>$!results.minProcessingTime</TD></TR>
     </table>
     </td><td>
     <table class="class="portlet-section-body" >
 	<tr class="portlet-section-subheader">
-		<TH><b>$criteria.queryType</b></TH><TH><b>count</b></TH><TH><b>max
Time</b></TH><TH><b>avg Time</b></TH><TH><b>min
Time</b></TH></TR>
+		<TH><b>$criteria.queryType</b>
+			</TH><TH><b>count</b></TH>
+			<TH><b>max Time</b></TH>
+			<TH><b>avg Time</b></TH>
+			<TH><b>min Time</b></TH>
+		</TR>
 	#foreach ( $row in $results.statlist )
   		<tr>
   			<td> $row.get("groupColumn") </td>
-  			<td> $row.get("count") </td>
-  			<td> $row.get("max") </td>
-  			<td> $row.get("avg") </td>
-  			<td> $row.get("min") </td>  			
+  			<td align="right" > $row.get("count") </td>
+  			<td align="right" > $row.get("max") </td>
+  			<td align="right" > $row.get("avg") </td>
+  			<td align="right" > $row.get("min") </td>  			
   		<tr>
   		
   	#end
     </table>
-    
-    </td></tr></table>
+    </td></tr>
+    <tr><td colspan="2" align="center"> <font size="-1" >all times in milliseconds</font></td></tr>
+    </table>
+    </form>
+	
 </div>

Modified: portals/jetspeed-2/trunk/components/statistics/src/java/org/apache/jetspeed/statistics/impl/AggregateStatisticsImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/statistics/src/java/org/apache/jetspeed/statistics/impl/AggregateStatisticsImpl.java?rev=331647&r1=331646&r2=331647&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/statistics/src/java/org/apache/jetspeed/statistics/impl/AggregateStatisticsImpl.java
(original)
+++ portals/jetspeed-2/trunk/components/statistics/src/java/org/apache/jetspeed/statistics/impl/AggregateStatisticsImpl.java
Mon Nov  7 15:55:54 2005
@@ -92,25 +92,6 @@
         return this.minProcessingTime;
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.jetspeed.statistics.AggregateStatistics#getStdDevProcessingTime()
-     */
-    public float getStdDevProcessingTime()
-    {
-        return this.stddevProcessingTime;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.jetspeed.statistics.AggregateStatistics#setAvgProcessingTime(float)
-     */
-    public void setAvgProcessingTime(float time)
-    {
-        this.avgProcessingTime = time;
-    }
 
     /*
      * (non-Javadoc)
@@ -119,6 +100,7 @@
      */
     public void setHitCount(int hitCount)
     {
+        
         this.hitcount = hitCount;
     }
 
@@ -129,7 +111,7 @@
      */
     public void setMaxProcessingTime(float time)
     {
-        this.maxProcessingTime = time;
+        this.maxProcessingTime = Math.round(time);
     }
 
     /*
@@ -139,18 +121,18 @@
      */
     public void setMinProcessingTime(float time)
     {
-        this.minProcessingTime = time;
+        this.minProcessingTime = Math.round(time);
     }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.jetspeed.statistics.AggregateStatistics#setStdDevProcessingTime(float)
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.statistics.AggregateStatistics#setAvgProcessingTime(float)
      */
-    public void setStdDevProcessingTime(float time)
+    public void setAvgProcessingTime(float time)
     {
-        this.stddevProcessingTime = time;
+        this.avgProcessingTime = Math.round(time);
+
     }
+
 
     public String toString()
     {

Modified: portals/jetspeed-2/trunk/components/statistics/src/java/org/apache/jetspeed/statistics/impl/PortalStatisticsImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/statistics/src/java/org/apache/jetspeed/statistics/impl/PortalStatisticsImpl.java?rev=331647&r1=331646&r2=331647&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/statistics/src/java/org/apache/jetspeed/statistics/impl/PortalStatisticsImpl.java
(original)
+++ portals/jetspeed-2/trunk/components/statistics/src/java/org/apache/jetspeed/statistics/impl/PortalStatisticsImpl.java
Mon Nov  7 15:55:54 2005
@@ -459,6 +459,7 @@
 
     }
 
+    
     /**
      * @see org.springframework.beans.factory.DisposableBean#destroy()
      */
@@ -617,7 +618,7 @@
 
         if (!"user".equals(queryType))
         {
-            query = "select count(*) as count , STDDEV(ELAPSED_TIME),MIN(ELAPSED_TIME),AVG(ELAPSED_TIME),MAX(ELAPSED_TIME)
from "
+            query = "select count(*) as count , MIN(ELAPSED_TIME),AVG(ELAPSED_TIME),MAX(ELAPSED_TIME)
from "
                     + tableName + " where time_stamp > ? and time_stamp < ?";
             query2 = "select count(*) as count ,"
                     + groupColumn
@@ -628,7 +629,7 @@
                     + " limit 5";
         } else
         {
-            query = "select count(*) as count , STDDEV(ELAPSED_TIME),MIN(ELAPSED_TIME),AVG(ELAPSED_TIME),MAX(ELAPSED_TIME)
from "
+            query = "select count(*) as count , MIN(ELAPSED_TIME),AVG(ELAPSED_TIME),MAX(ELAPSED_TIME)
from "
                     + tableName
                     + " where time_stamp > ? and time_stamp < ? and status = 2";
             query2 = "select count(*) as count ,"
@@ -650,7 +651,6 @@
             if (rs.next())
             {
                 as.setHitCount(rs.getInt("count"));
-                as.setStdDevProcessingTime(rs.getFloat("STDDEV(ELAPSED_TIME)"));
                 as.setMinProcessingTime(rs.getFloat("MIN(ELAPSED_TIME)"));
                 as.setAvgProcessingTime(rs.getFloat("AVG(ELAPSED_TIME)"));
                 as.setMaxProcessingTime(rs.getFloat("MAX(ELAPSED_TIME)"));
@@ -664,10 +664,16 @@
             {
                 Map row = new HashMap();
                 row.put("count", "" + rs2.getInt("count"));
-                row.put("groupColumn", rs2.getString(groupColumn));
-                row.put("min", "" + rs2.getFloat("min"));
-                row.put("avg", "" + rs2.getFloat("avg"));
-                row.put("max", "" + rs2.getFloat("max"));
+                String col = rs2.getString(groupColumn);
+                int maxColLen = 35;
+                if(col.length() > maxColLen ) {
+                    col = col.substring(0,maxColLen);
+                }
+                
+                row.put("groupColumn", col);
+                row.put("min", "" + floatFormatter(rs2.getFloat("min")));
+                row.put("avg", "" + floatFormatter(rs2.getFloat("avg")));
+                row.put("max", "" + floatFormatter(rs2.getFloat("max")));
                 as.addRow(row);
             }
 
@@ -679,6 +685,11 @@
         return as;
     }
 
+    private String floatFormatter(float f) {
+        // for now we'll just truncate as int
+        int f2 = new Float(f).intValue();
+        return Integer.toString(f2);
+    }
     /*
      * (non-Javadoc)
      * 

Modified: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/statistics/AggregateStatistics.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/statistics/AggregateStatistics.java?rev=331647&r1=331646&r2=331647&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/statistics/AggregateStatistics.java
(original)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/statistics/AggregateStatistics.java
Mon Nov  7 15:55:54 2005
@@ -39,8 +39,6 @@
 
     public float getMaxProcessingTime();
 
-    public float getStdDevProcessingTime();
-
     public void setHitCount(int hitCount);
 
     public void setAvgProcessingTime(float time);
@@ -48,8 +46,6 @@
     public void setMinProcessingTime(float time);
 
     public void setMaxProcessingTime(float time);
-
-    public void setStdDevProcessingTime(float time);
 
     public List getStatlist();
 



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message