00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030  
00031 package org.objectweb.proactive.benchmarks.timit.util;
00032 
00033 import java.io.Serializable;
00034 import java.lang.reflect.InvocationTargetException;
00035 
00036 import org.objectweb.proactive.ProActive;
00037 
00046 public class BenchmarkStatistics implements Serializable {
00047 
00051     private static final long serialVersionUID = -2107445173337154096L;
00052 
00053     private HierarchicalTimerStatistics time;
00054 
00055     private EventStatistics events;
00056 
00057     
00058     
00059     private String information;
00060 
00061     public BenchmarkStatistics() {
00062     }
00063 
00064     public BenchmarkStatistics(HierarchicalTimerStatistics time,
00065             EventStatistics events,
00066             
00067             String information) {
00068         this.time = time;
00069         this.events = events;
00070         
00071         
00072         this.information = information;
00073     }
00074 
00075     public HierarchicalTimerStatistics getTimerStatistics() {
00076         
00077         
00078         
00079         return this.time;
00080     }
00081 
00082     public EventStatistics getEventsStatistics() {
00083         
00084         
00085         
00086         return this.events;
00087     }
00088 
00089     public String getFinalEnvironment() {
00090         String res = "Deployer environment :";
00091         
00092         
00093         
00094         res += "\nOS Version : " + System.getProperty("os.arch") + " "
00095                 + System.getProperty("os.name") + " "
00096                 + System.getProperty("os.version");
00097         res += "\nJava Version : " + System.getProperty("java.version");
00098         res += "\nProactive Version : ";
00099         try {
00100             res += (String) ProActive.class.getMethod("getProActiveVersion",
00101                     new Class[0]).invoke(null, new Object[0]);
00102         } catch (InvocationTargetException e) {
00103             e.printStackTrace();
00104         } catch (IllegalArgumentException e) {
00105             e.printStackTrace();
00106         } catch (SecurityException e) {
00107             e.printStackTrace();
00108         } catch (IllegalAccessException e) {
00109             e.printStackTrace();
00110         } catch (NoSuchMethodException e) {
00111             res += "N/A (<3.1)";
00112         }
00113 
00114         return res;
00115     }
00116 
00117     public String getInformation() {
00118         if (this.information == null) {
00119             return "";
00120         }
00121         return this.information;
00122     }
00123 
00124     public String toString() {
00125         return "\n"
00126                 + (this.time != null && this.time.toString().length() != 0 ? "Timers statistics\n"
00127                         + "=================\n" + this.time.toString() + "\n\n"
00128                         : "")
00129                 + (this.events != null && this.events.toString().length() != 0 ? "Events statistics\n"
00130                         + "=================\n" + this.events.toString() + "\n"
00131                         : "");
00132     }
00133 }