producer timing finish to producer.java
authorrk <rk>
Mon, 18 Feb 2002 11:29:55 +0000 (11:29 +0000)
committerrk <rk>
Mon, 18 Feb 2002 11:29:55 +0000 (11:29 +0000)
source/mircoders/producer/Producer.java
source/mircoders/producer/ProducerContent.java
source/mircoders/producer/ProducerTopics.java

index ad27fee..1c0f433 100755 (executable)
@@ -151,6 +151,18 @@ abstract public class Producer {
        /**
         * logging
         */
+
+  public void logHTMLFinish(PrintWriter htmlout,String moduleName, int pageCount, long startTime, long endTime) {
+    // timing and message to browser
+    long overall = endTime - startTime;
+    long pagesPerMinute=0; float perMinute = overall/60000;
+    if (perMinute >0) pagesPerMinute = (long) (pageCount / perMinute);
+
+    logHTML(htmlout, "Producer."+moduleName+" finished producing: " +
+            overall + " ms for "+ pageCount+" Pages = " +pagesPerMinute + " pages/min");
+    logHTML(htmlout, "Back to <a href=\""+actionRoot+"\">Admin-Startage</a>");
+  }
+
        public void logHTML(PrintWriter out, String s) {
                _print(out, s, true);
        }
index 0e3953f..633de45 100755 (executable)
@@ -117,14 +117,10 @@ public class ProducerContent extends Producer {
         pageCount++;
       }//for
     }
-    // timing and message to browser
-    long overall = System.currentTimeMillis() - startTime;
-    long pagesPerMinute=0; float perMinute = overall/60000;
-    if (perMinute >0) pagesPerMinute = (long) (pageCount / perMinute);
-
-    logHTML(htmlout, "Producer.Content finished producing: " +
-            overall + " ms for "+ pageCount+" Pages = " +pagesPerMinute + " pages/min");
-    logHTML(htmlout, "Back to <a href=\""+actionRoot+"\">Admin-Startage</a>");
+
+
+
+    logHTMLFinish(htmlout, "Content", pageCount, startTime, System.currentTimeMillis());
 
     /** @todo why no syncing here? */
 
index 6133a17..847ac08 100755 (executable)
@@ -46,11 +46,16 @@ public class ProducerTopics extends ProducerList {
   }
 
   public void handle(PrintWriter htmlout, EntityUsers user, boolean force, boolean sync)
-    throws StorageObjectException, ModuleException {
+    throws StorageObjectException, ModuleException
+  {
+    long startTime = System.currentTimeMillis();
+    int pageCount =0;
+    logHTML(htmlout, "Producer.List: started");
 
-    orderBy="date desc, webdb_create desc";
+    /** @todo should be done in static */
     listTemplate = MirConfig.getProp("Producer.TopicList.Template");
 
+    orderBy="date desc, webdb_create desc";
     EntityList topicsEntityList;
     if(where==null){
       topicsEntityList = topicsModule.getByWhereClause("","title", -1);
@@ -114,6 +119,7 @@ public class ProducerTopics extends ProducerList {
         setAdditional("topicslist",topicsEntityList);
 
         handleIt(htmlout,user,force);
+        pageCount++;
       }
       } catch (Exception e) {
         theLog.printError("ProducerTopics: problem with start special media: "
@@ -122,6 +128,7 @@ public class ProducerTopics extends ProducerList {
         +currentTopic.getId()+ "<font color=\"red\">skipping</font>");
       }
     }
+    logHTMLFinish(htmlout, "Topics", pageCount, startTime, System.currentTimeMillis());
   }
 
   public static void main(String argv[]){