org/objectweb/proactive/benchmarks/timit/util/BenchmarkStatistics.java

00001 /* 
00002  * ################################################################
00003  * 
00004  * ProActive: The Java(TM) library for Parallel, Distributed, 
00005  *            Concurrent computing with Security and Mobility
00006  * 
00007  * Copyright (C) 1997-2007 INRIA/University of Nice-Sophia Antipolis
00008  * Contact: proactive@objectweb.org
00009  * 
00010  * This library is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU Lesser General Public
00012  * License as published by the Free Software Foundation; either
00013  * version 2.1 of the License, or any later version.
00014  *  
00015  * This library is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  * Lesser General Public License for more details.
00019  * 
00020  * You should have received a copy of the GNU Lesser General Public
00021  * License along with this library; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
00023  * USA
00024  *  
00025  *  Initial developer(s):               The ProActive Team
00026  *                        http://www.inria.fr/oasis/ProActive/contacts.html
00027  *  Contributor(s): 
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     // private long memory;
00058     // private int nbProc;
00059     private String information;
00060 
00061     public BenchmarkStatistics() {
00062     }
00063 
00064     public BenchmarkStatistics(HierarchicalTimerStatistics time,
00065             EventStatistics events,
00066             // long memory, int nbProc,
00067             String information) {
00068         this.time = time;
00069         this.events = events;
00070         // this.memory=memory;
00071         // this.nbProc=nbProc;
00072         this.information = information;
00073     }
00074 
00075     public HierarchicalTimerStatistics getTimerStatistics() {
00076         // if( time == null ) {
00077         // return new HierarchicalTimerStatistics();
00078         // }
00079         return this.time;
00080     }
00081 
00082     public EventStatistics getEventsStatistics() {
00083         // if( events == null ) {
00084         // return new EventStatistics();
00085         // }
00086         return this.events;
00087     }
00088 
00089     public String getFinalEnvironment() {
00090         String res = "Deployer environment :";
00091         // res += information;
00092         // res += "\nAvailable processors by JVM : "+nbProc;
00093         // res += "\nTotal Memory by JVM: "+(memory/1024.0/1024.0)+"MB";
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 }

Generated on Mon Jan 22 15:16:04 2007 for ProActive by  doxygen 1.5.1