package ca.umontreal.iro.rali; import java.lang.management.ManagementFactory; public class Examine{ /** * count the number of successful extractions */ protected static int count=0; /** * count the number of effective tests on the skeleton documents during execution */ protected static int nbTests=0; /** * number of bytes in the input file (does not take into account included files) */ private static long fileLength=0; /** * Main program that parses arguments, sets up the input and output files and prints the results * * @param argv arguments as given the system */ public static void main(String[] argv){ Options.parseArgs(argv); long now = System.currentTimeMillis(); if(Options.onlyCount)Options.rootName=null; // do processing if(Options.xpathStr==null) fileLength=Options.sax?ExploreSAX.execute():Explore.execute(); else fileLength=Options.sax?ExtractSAX.execute():Extract.execute(); // output statistics if(Options.statistics){ System.err.println((Options.sax?"SAX":"Pull")+" parser used"); if(Options.xpathStr!=null) System.err.println("pattern="+Options.xpathStr+" count="+count+" nb tests="+nbTests); if(Options.inputFileName!=null) if(fileLength<100000) System.err.format("file:%s length=%d bytes\n",Options.inputFileName,fileLength); else System.err.format("File:%s length=%.1f megabytes\n",Options.inputFileName,(fileLength/1000000.0)); System.err.println("Time="+((System.currentTimeMillis()-now)/1000.0)); // not sure that the information about memory is accurate or even relevant... System.err.format("Memory used=%.1f megabytes\n", ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed()/1000000.0); } } }