1 7 package org.jboss.test.remoting.performance; 8 9 import java.io.File ; 10 import java.io.FileWriter ; 11 import java.io.IOException ; 12 import java.util.Date ; 13 import java.util.Iterator ; 14 import java.util.Map ; 15 16 19 public class PerformanceReporter 20 { 21 32 public static void writeReport(String testName, long totalTime, int totalCount, Map metadata) throws IOException 33 { 34 File reportFile = new File ("performance_report.txt"); 35 if(!reportFile.exists()) 36 { 37 reportFile.createNewFile(); 38 } 39 40 FileWriter reportWriter = new FileWriter (reportFile, true); 41 reportWriter.write("\n\nTest results for test: " + testName + "\n"); 42 reportWriter.write("When run: " + new Date ()); 43 reportWriter.write("\nTotal count: " + totalCount); 44 reportWriter.write("\nTotal time: " + totalTime); 45 if(metadata != null) 46 { 47 Iterator itr = metadata.keySet().iterator(); 48 while(itr.hasNext()) 49 { 50 Object key = itr.next(); 51 Object value = metadata.get(key); 52 reportWriter.write("\n" + key + " = " + value); 53 } 54 } 55 reportWriter.write("\n\n"); 56 reportWriter.close(); 57 } 58 } | Popular Tags |