pauldick    2002/06/14 08:14:13

  Modified:    test/java/src/org/apache/qetest/dtm QeDtmUtils.java
  Log:
  Updates associated with AxisTraverser
  
  Revision  Changes    Path
  1.2       +40 -8     xml-xalan/test/java/src/org/apache/qetest/dtm/QeDtmUtils.java
  
  Index: QeDtmUtils.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/test/java/src/org/apache/qetest/dtm/QeDtmUtils.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- QeDtmUtils.java   13 Jun 2002 20:57:24 -0000      1.1
  +++ QeDtmUtils.java   14 Jun 2002 15:14:13 -0000      1.2
  @@ -197,23 +197,24 @@
   
   
        buf.append("\nInit of DTM took: \t"+ (dtmStop-dtmStart) + "\n");
  +     System.out.println(buf);
        return dtm;
   }
   
  - public static void timeAxis(DTM dtm, int axis, int context, int[] rtdata)
  + public static void timeAxisIterator(DTM dtm, int axis, int context, int[] rtdata)
     {  
       long startTime = 0;
  -    long travTime = 0;
  +    long iterTime = 0;
        int atNode = 0;
        int lastNode = 0;                                                       
        int numOfNodes =0;
   
  +     // Time creation and iteration.
  +     startTime = System.currentTimeMillis();
  +
       DTMAxisIterator iter = dtm.getAxisIterator(axis);
       iter.setStartNode(context);
   
  -     // Time the iteration.
  -     startTime = System.currentTimeMillis();
  -
       for (atNode = iter.next(); DTM.NULL != atNode;
                     atNode = iter.next())
                { 
  @@ -221,14 +222,45 @@
                  numOfNodes = numOfNodes + 1;  // Need to know that we Iterated the 
whole tree
        }
   
  +    iterTime = System.currentTimeMillis() - startTime;
  +
  +     getNodeInfo(dtm, lastNode, " ");
  +
  +     rtdata[0] = (int)iterTime;
  +     rtdata[1] = lastNode;
  +     rtdata[2] = numOfNodes;
  +  }
  +
  +  
  +static void timeAxisTraverser(DTM dtm, int axis, int context, int[] rtdata)
  +  {  
  +    long startTime = 0;
  +    long travTime = 0;
  +     int atNode = 0;
  +     int lastNode = 0;
  +     int numOfNodes =0;
  +
  +     // Time the creation and traversal.
  +     startTime = System.currentTimeMillis();
  +
  +     DTMAxisTraverser at = dtm.getAxisTraverser(axis);
  +
  +    for (atNode = at.first(context); DTM.NULL != atNode;
  +                  atNode = at.next(context, atNode))
  +             { 
  +          lastNode = atNode;
  +               numOfNodes = numOfNodes + 1;
  +     }
  +
       travTime = System.currentTimeMillis() - startTime;
   
  -     QeDtmUtils.getNodeInfo(dtm, lastNode, " ");
  +     getNodeInfo(dtm, lastNode, " ");
   
        rtdata[0] = (int)travTime;
        rtdata[1] = lastNode;
        rtdata[2] = numOfNodes;
  -  }
  +
  + }
   
   // This routine gathers up all the important info about a node, concatenates
   // in all together into a single string and returns it. 
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to