00001 // Copyright 2009-2015 Sandia Corporation. Under the terms 00002 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. 00003 // Government retains certain rights in this software. 00004 // 00005 // Copyright (c) 2009-2015, Sandia Corporation 00006 // All rights reserved. 00007 // 00008 // This file is part of the SST software package. For license 00009 // information, see the LICENSE file in the top level directory of the 00010 // distribution. 00011 00012 #ifndef _H_SST_CORE_STATISTICS_OUTPUTCONSOLE 00013 #define _H_SST_CORE_STATISTICS_OUTPUTCONSOLE 00014 00015 #include "sst/core/sst_types.h" 00016 #include <sst/core/serialization.h> 00017 00018 #include <sst/core/statapi/statoutput.h> 00019 00020 namespace SST { 00021 namespace Statistics { 00022 00023 /** 00024 \class StatisticOutputConsole 00025 00026 The class for statistics output to the console. This will be the 00027 default statistic output in SST. 00028 */ 00029 class StatisticOutputConsole : public StatisticOutput 00030 { 00031 public: 00032 /** Construct a StatOutputConsole 00033 * @param outputParameters - Parameters used for this Statistic Output 00034 */ 00035 StatisticOutputConsole(Params& outputParameters); 00036 00037 protected: 00038 /** Perform a check of provided parameters 00039 * @return True if all required parameters and options are acceptable 00040 */ 00041 bool checkOutputParameters(); 00042 00043 /** Print out usage for this Statistic Output */ 00044 void printUsage(); 00045 00046 /** Indicate to Statistic Output that simulation started. 00047 * Statistic output may perform any startup code here as necessary. 00048 */ 00049 void startOfSimulation(); 00050 00051 /** Indicate to Statistic Output that simulation ended. 00052 * Statistic output may perform any shutdown code here as necessary. 00053 */ 00054 void endOfSimulation(); 00055 00056 /** Implementation function for the start of output. 00057 * This will be called by the Statistic Processing Engine to indicate that 00058 * a Statistic is about to send data to the Statistic Output for processing. 00059 * @param statistic - Pointer to the statistic object than the output can 00060 * retrieve data from. 00061 */ 00062 void implStartOutputEntries(StatisticBase* statistic); 00063 00064 /** Implementation function for the end of output. 00065 * This will be called by the Statistic Processing Engine to indicate that 00066 * a Statistic is finished sendind data to the Statistic Output for processing. 00067 * The Statisic Output can perform any output related functions here. 00068 */ 00069 void implStopOutputEntries(); 00070 00071 /** Implementation functions for output. 00072 * These will be called by the statistic to provide Statistic defined 00073 * data to be output. 00074 * @param fieldHandle - The handle to the registered statistic field. 00075 * @param data - The data related to the registered field to be output. 00076 */ 00077 void implOutputField(fieldHandle_t fieldHandle, int32_t data); 00078 void implOutputField(fieldHandle_t fieldHandle, uint32_t data); 00079 void implOutputField(fieldHandle_t fieldHandle, int64_t data); 00080 void implOutputField(fieldHandle_t fieldHandle, uint64_t data); 00081 void implOutputField(fieldHandle_t fieldHandle, float data); 00082 void implOutputField(fieldHandle_t fieldHandle, double data); 00083 00084 protected: 00085 StatisticOutputConsole() {;} // For serialization 00086 00087 private: 00088 std::string m_OutputBuffer; 00089 00090 friend class boost::serialization::access; 00091 template<class Archive> 00092 void serialize(Archive & ar, const unsigned int version) 00093 { 00094 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(StatisticOutput); 00095 ar & BOOST_SERIALIZATION_NVP(m_OutputBuffer); 00096 } 00097 }; 00098 00099 } //namespace Statistics 00100 } //namespace SST 00101 00102 BOOST_CLASS_EXPORT_KEY(SST::Statistics::StatisticOutputConsole) 00103 00104 #endif