You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by zo...@apache.org on 2002/09/09 18:46:49 UTC

cvs commit: xml-xalan/java/src/org/apache/xalan/xsltc/cmdline Transform.java

zongaro     2002/09/09 09:46:49

  Modified:    java/src/org/apache/xalan/xsltc/cmdline Transform.java
  Log:
  Change committed on behalf of Igor Hersht: added -DIAG option similar to that
  supported by org.apache.xalan.xslt.Process class (for bug 12261).
  
  Also (on my own behalf) changed calculation of average transform time and
  throughput rate for -n option to use floating-point division, rather than
  integer division; latter yielded meaningless results.
  
  Revision  Changes    Path
  1.21      +32 -5     xml-xalan/java/src/org/apache/xalan/xsltc/cmdline/Transform.java
  
  Index: Transform.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/cmdline/Transform.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- Transform.java	11 Jun 2002 20:11:17 -0000	1.20
  +++ Transform.java	9 Sep 2002 16:46:49 -0000	1.21
  @@ -118,7 +118,10 @@
   	_uri = uri;
   	_debug = debug;
   	_iterations = iterations;
  -    }
  +  }
  +  
  +   public String getFileName(){return _fileName;}
  +   public String getClassName(){return _className;}
   
       public void setParameters(Vector params) {
   	_params = params;
  @@ -224,8 +227,13 @@
   		mm = System.currentTimeMillis() - mm;
   
   		System.err.println("\n<!--");
  -		System.err.println("  transform  = " + (mm / _iterations) + " ms");
  -		System.err.println("  throughput = " + (1000.0 / (mm / _iterations)) + " tps");
  +		System.err.println("  transform  = "
  +                                   + (((double) mm) / ((double) _iterations))
  +                                   + " ms");
  +		System.err.println("  throughput = "
  +                                   + (1000.0 / (((double) mm)
  +                                                 / ((double) _iterations)))
  +                                   + " tps");
   		System.err.println("-->");
   	    }
   	}
  @@ -303,7 +311,9 @@
   		boolean uri = false, debug = false;
   		boolean isJarFileSpecified = false;
   		String  jarFile = null;
  -
  +		boolean doDiag = false;
  +		long start=0;
  +		long stop=0;
   		// Parse options starting with '-'
   		for (i = 0; i < args.length && args[i].charAt(0) == '-'; i++) {
   		    if (args[i].equals("-u")) {
  @@ -330,6 +340,9 @@
   			    // ignore
   			}
   		    }
  +		    else if ("-DIAG".equalsIgnoreCase(args[i])){
  +          		doDiag = true;
  +		    }
   		    else {
   			printUsage();
   		    }
  @@ -359,7 +372,21 @@
   
   		if (i == args.length) {
   		    handler.setParameters(params);
  +		    if (doDiag) {
  +			start = System.currentTimeMillis();
  +		    }
   		    handler.doTransform();
  +		    if (doDiag) {
  +			stop = System.currentTimeMillis();
  +			long millisecondsDuration = stop - start;
  +			String msg = "--------- Transform of "
  +                                   + handler.getFileName() + " via "
  +                                   + handler.getClassName() + " took "
  +                                   + millisecondsDuration + " ms"; 
  +			java.io.PrintWriter diagnosticsWriter =
  +                                              new PrintWriter(System.err, true);
  +			diagnosticsWriter.println(msg);
  +   		    }
   		    if (_allowExit) System.exit(0);
   		}
   	    } else {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org