Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 17 package org.apache.jmeter.monitor.model.benchmark; 18 19 23 public class ParseBenchmark 24 { 25 26 29 public ParseBenchmark() 30 { 31 super(); 32 } 33 34 public static void main(String [] args) 35 { 36 if (args.length == 3){ 37 int parser = 0; 38 String file = null; 39 int loops = 1000; 40 if (args[0] != null){ 41 if (!args[0].equals("jaxb")){ 42 parser = 1; 43 } 44 } 45 if (args[1] != null){ 46 file = args[1]; 47 } 48 if (args[2] != null){ 49 loops = Integer.parseInt(args[2]); 50 } 51 52 java.io.File infile = new java.io.File (file); 53 java.io.FileInputStream fis = null; 54 java.io.InputStreamReader isr = null; 55 StringBuffer buf = new StringBuffer (); 56 try { 57 fis = new java.io.FileInputStream (infile); 58 isr = new java.io.InputStreamReader (fis); 59 java.io.BufferedReader br = new java.io.BufferedReader (isr); 60 String line = null; 61 while ((line = br.readLine()) != null){ 62 buf.append(line); 63 } 64 } catch (Exception e){ 65 e.printStackTrace(); 66 } 67 long start = 0; 68 long end = 0; 69 String contents = buf.toString().trim(); 70 System.out.println("start test: " + loops + " iterations"); 71 System.out.println("content:"); 72 System.out.println(contents); 73 74 if (parser == 0){ 75 92 } else { 93 org.apache.jmeter.monitor.model.ObjectFactory of = 94 org.apache.jmeter.monitor.model.ObjectFactory.getInstance(); 95 start = System.currentTimeMillis(); 96 for (int idx=0; idx < loops; idx++){ 97 of.parseBytes(contents.getBytes()); 99 } 100 end = System.currentTimeMillis(); 101 System.out.println("elapsed Time: " + (end - start)); 102 } 103 104 } else { 105 System.out.println("missing paramters:"); 106 System.out.println("parser file iterations"); 107 System.out.println("example: jaxb status.xml 1000"); 108 } 109 } 110 } 111
| Popular Tags
|