Commits

dloy committed da275dc

Add TimeUtil dumps

Comments (0)

Files changed (1)

fixity-src/src/main/java/org/cdlib/mrt/fixity/action/ProcessFixityEntry.java

 import org.cdlib.mrt.utility.PropertiesUtil;
 import org.cdlib.mrt.utility.LoggerInf;
 import org.cdlib.mrt.utility.TException;
+import org.cdlib.mrt.utility.TimerUtil;
 
 /**
  * Run fixity
     public void run()
     {
         switch(cmdType) {
-            case add: runAdd(); return;
-            case test: runTest(); return;
-            case queue: runQueue(); return;
-            case update: runUpdate(); return;
+            case add: 
+                TimerUtil.start(logger, "runAdd");
+                runAdd();
+                TimerUtil.end(logger, "runAdd");
+                return;
+            case test:  
+                TimerUtil.start(logger, "runTest");
+                runTest();
+                TimerUtil.end(logger, "runTest");
+                return;
+            case queue:  
+                TimerUtil.start(logger, "runQueue");
+                runQueue();
+                TimerUtil.end(logger, "runQueue");
+                return;
+            case update:  
+                TimerUtil.start(logger, "runUpdate");
+                runUpdate();
+                TimerUtil.end(logger, "runUpdate");
+                return;
             default: {
                 TException tex = new TException.INVALID_ARCHITECTURE("Unsupported cmdType:" + cmdType.toString());
                 setRunException(tex);
     public void runAdd()
     {
         try {
-            log("runAdd entered");
             connection.setAutoCommit(false);
             if(itemExists(entry)) {
                 throw new TException.REQUEST_ITEM_EXISTS(
                         "URL of add matches existing item:" + entry.getUrl());
             }
-            log("before handler.validate");
             handler = FixityHandlerAbs.getFixityHandler(entry, logger);
+            TimerUtil.start(logger, "runAdd validate");
             handler.validate();
-            log("before runFixity");
+            TimerUtil.end(logger, "runAdd validate");
+
+            TimerUtil.start(logger, "runAdd fixity");
             handler.runFixity();
+            TimerUtil.end(logger, "runAdd fixity");
+
             if (entry.getStatus() != FixityEntry.StatusType.verified) {
                 throw new TException.REQUEST_INVALID("Fixity Test fails item not added:" + entry.getStatus().getItemDBStatus());
             }
-            log("before replaceEntry");
+            TimerUtil.start(logger, "runAdd insertEntry");
             insertEntry();
+            TimerUtil.end(logger, "runAdd insertEntry");
+
+            TimerUtil.start(logger, "runAdd commit");
             connection.commit();
+            TimerUtil.end(logger, "runAdd commit");
 
         } catch (Exception ex) {
             setRunException(ex);
                         "No matching URL was found for this item:" + entry.getUrl());
             }
             FixityEntry dbEntry = FixityDBUtil.getEntry(connection, id, logger);
+
+            TimerUtil.start(logger, "runUpdate getStatus");
             FixityEntry.StatusType dbStatus = dbEntry.getStatus();
             DateState dbVerifiedDate = dbEntry.getVerified();
             if (DEBUG) dbEntry.printEntry("IN UPDATE: dbEntry");
             FixityEntry mergeEntry = dbEntry.mergeFromEntry(entry);
             entry = mergeEntry;
             if (DEBUG) entry.printEntry("IN UPDATE");
+            TimerUtil.end(logger, "runUpdate getStatus");
 
-            log("before handler.validate");
+            TimerUtil.start(logger, "runUpdate validate");
             handler = FixityHandlerAbs.getFixityHandler(entry, logger);
             handler.validate();
-            log("before runFixity");
+            TimerUtil.end(logger, "runUpdate validate");
+
+            TimerUtil.start(logger, "runUpdate runFixity");
             if (isFixityDiff(dbEntry, mergeEntry)) {
                 handler.runFixity();
                 if (entry.getStatus() != FixityEntry.StatusType.verified) {
                 entry.setVerified(dbVerifiedDate);
                 log ("no Fixity diff");
             }
+            TimerUtil.end(logger, "runUpdate runFixity");
 
-            log("runUpdate before replaceEntry");
+            TimerUtil.start(logger, "runUpdate replaceEntry");
             insertEntry();
+            TimerUtil.end(logger, "runUpdate replaceEntry");
+
+            TimerUtil.start(logger, "runUpdate commit");
             connection.commit();
+            TimerUtil.end(logger, "runUpdate commit");
 
         } catch (Exception ex) {
             setRunException(ex);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.