Project

General

Profile

Revision 3271

Added by Jing Tao about 14 years ago

Add formated output for time measurement.

View differences:

src/edu/ucsb/nceas/metacat/DBQuery.java
327 327
         double endHTMLTransform = System.currentTimeMillis()/1000;
328 328
                   logMetacat.warn("The time to transfrom resultset from xml to html format is "
329 329
                  		                             +(endHTMLTransform -startHTMLTransform));
330
                   MetaCatUtil.writeDebugToFile("---------------------------------------------------------------------------------------------------------------Transfrom xml to html  "
331
                             +(endHTMLTransform -startHTMLTransform));
330 332
        }
331 333
        catch(Exception e)
332 334
        {
......
540 542
      double queryExecuteTime = System.currentTimeMillis() / 1000;
541 543
      logMetacat.warn("Time to execute select docid query is "
542 544
                    + (queryExecuteTime - startTime));
545
      MetaCatUtil.writeDebugToFile("\n\n\n\n\n\nExecute selection query  "
546
              + (queryExecuteTime - startTime));
543 547

  
544 548
      boolean tableHasRows = rs.next();
545 549
      
......
767 771
     double docListTime = System.currentTimeMillis() / 1000;
768 772
     logMetacat.warn("======Total time to get docid list is: "
769 773
                          + (docListTime - startSelectionTime ));
774
     MetaCatUtil.writeDebugToFile("---------------------------------------------------------------------------------------------------------------Total selection: "
775
             + (docListTime - startSelectionTime ));
770 776
     //if docListResult is not empty, it need to be sent.
771 777
     if (docListResult.size() != 0)
772 778
     {
......
835 841
     double endGetReturnValueFromQueryresultable = System.currentTimeMillis()/1000;
836 842
     logMetacat.warn("Time to get return fields from xml_queryresult table is (Part1 in return fields) " +
837 843
          		               (endGetReturnValueFromQueryresultable-startGetReturnValueFromQueryresultable));
844
     MetaCatUtil.writeDebugToFile("-----------------------------------------Get fields from xml_queryresult(Part1 in return fields) " +
845
               (endGetReturnValueFromQueryresultable-startGetReturnValueFromQueryresultable));
838 846
     // backup the keys-elements in partOfDoclist to check later
839 847
     // if the doc entry is indexed yet
840 848
     Hashtable partOfDoclistBackup = new Hashtable();
......
852 860
     partOfDoclist = addReturnfield(partOfDoclist, qspec, user, groups,
853 861
                                        dbconn, useXMLIndex);
854 862
     double endExtendedQuery = System.currentTimeMillis()/1000;
855
     logMetacat.warn("Time to get return fields through execute extended query (Part2 in return fields) "
863
     logMetacat.warn("Get fields from index and node table (Part2 in return fields) "
856 864
        		                                          + (endExtendedQuery - endGetReturnValueFromQueryresultable));
865
     MetaCatUtil.writeDebugToFile("-----------------------------------------Get fields from extened query(Part2 in return fields) "
866
             + (endExtendedQuery - endGetReturnValueFromQueryresultable));
857 867
     //add relationship part part docid list for the documents in partOfDocList
858 868
     partOfDoclist = addRelationship(partOfDoclist, qspec, dbconn, useXMLIndex);
859 869

  
......
904 914
     double endStoreReturnField = System.currentTimeMillis()/1000;
905 915
     logMetacat.warn("Time to store new return fields into xml_queryresult table (Part4 in return fields) "
906 916
                   + (endStoreReturnField -startStoreReturnField));
917
     MetaCatUtil.writeDebugToFile("-----------------------------------------Insert new record to xml_queryresult(Part4 in return fields) "
918
             + (endStoreReturnField -startStoreReturnField));
907 919
     
908 920
     Enumeration keysE = queryresultDocList.keys();
909 921
     while (keysE.hasMoreElements())
......
922 934
     double returnFieldTime = System.currentTimeMillis() / 1000;
923 935
     logMetacat.warn("======Total time to get return fields is: "
924 936
                           + (returnFieldTime - startReturnField));
937
     MetaCatUtil.writeDebugToFile("---------------------------------------------------------------------------------------------------------------"+
938
    		 "Total to get return fields  "
939
                                   + (returnFieldTime - startReturnField));
925 940
     return resultset;
926 941
 }
927 942

  
......
1156 1171
               logMetacat.warn(
1157 1172
                   "Time to execute extended query: "
1158 1173
                   + (extendedQueryEnd - extendedQueryStart));
1174
               MetaCatUtil.writeDebugToFile(
1175
                       "Execute extended query "
1176
                       + (extendedQueryEnd - extendedQueryStart));
1159 1177
               tableHasRows = rs.next();
1160 1178
               while (tableHasRows) {
1161 1179
                   ReturnFieldValue returnValue = new ReturnFieldValue();
......
1242 1260
                   "Time to get attribute return value after"
1243 1261
                   + " execute extended query: "
1244 1262
                   + (endGetAttribute - startGetAttribute));
1263
           MetaCatUtil.writeDebugToFile(
1264
                   "Get attribute return field "
1265
                   + (endGetAttribute - startGetAttribute));
1245 1266
           
1267
           
1246 1268
       }//if doclist lenght is great than zero
1247 1269

  
1248 1270
     }//if has extended query
......
1315 1337
      
1316 1338
    }//while
1317 1339
    double endRelation = System.currentTimeMillis() / 1000;
1318
    logMetacat.info("Time to add relationship to return fields (part 3 in return fields): "
1340
    logMetacat.warn("Time to add relationship to return fields (part 3 in return fields): "
1319 1341
                             + (endRelation - startRelation));
1342
    MetaCatUtil.writeDebugToFile("-----------------------------------------Add relationship to return field(part3 in return fields): "
1343
            + (endRelation - startRelation));
1320 1344

  
1321 1345
    return docListResult;
1322 1346
  }//addRelation

Also available in: Unified diff