• Classes
  • Modules
  • Namespaces
  • Files
  • Related Pages
  • File List
  • File Members

loggingStatistics.h

Go to the documentation of this file.
00001 #ifndef logging_statistics_H
00002 #define logging_statistics_H
00003 /*******************************************************************************
00004 * ALMA - Atacama Large Millimiter Array
00005 * (c) Associated Universities Inc., 2005 
00006 * 
00007 * This library is free software; you can redistribute it and/or
00008 * modify it under the terms of the GNU Lesser General Public
00009 * License as published by the Free Software Foundation; either
00010 * version 2.1 of the License, or (at your option) any later version.
00011 * 
00012 * This library is distributed in the hope that it will be useful,
00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 * Lesser General Public License for more details.
00016 * 
00017 * You should have received a copy of the GNU Lesser General Public
00018 * License along with this library; if not, write to the Free Software
00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00020 *
00021 * who       when      what
00022 * --------  --------  ----------------------------------------------
00023 * mmanas  2014-11-11  created
00024 */
00025 
00030 #ifndef __cplusplus
00031 #error This is a C++ include file and cannot be used from plain C
00032 #endif
00033 
00034 #include "acsutilTimeStamp.h"
00035 #include <list>
00036 #include <string>
00037 #include <Basic_Types.h>  // instead #include <stdint.h>
00038 
00039 
00040 namespace Logging 
00041 {
00042         // This class includes all cpp statistics aspects of the ACS logging system
00043     class loggingStatistics
00044     {
00045     private:
00046         // Boolean defining if the statistics module is active or inactive
00047         bool disableStatistics;
00048         // Identification string of the statistics. Composed by component name + logger name
00049         std::string statisticsIdentification;
00050 
00051         // Number of valid messages logged during last period
00052         uint32_t accumulatedNumberOfMessages;
00053         // Number of logging errors generated during last period
00054         uint32_t accumulatedNumberOfLogErrors;
00055         // Last time instant of statistics calculation and repporting [timestamp]
00056         uint64_t lastStatisticsRepportTime;
00057         // Time between statistics calculation and repporting [in seconds] Default = 10 minutes
00058         uint32_t statisticsCalculationPeriod;
00059         // Granularity of the statistics [in seconds]. Default = 1 second
00060         uint32_t statisticsGranularity;
00061         // Last period backup of accumulatedNumberOfMessages
00062         uint32_t lastPeriodNumberOfMessages;
00063         // Last period backup of accumaltedNumberOfLogErrors
00064         uint32_t lastPeriodNumberOfLogErrors;
00065 
00066         // Statistics calculation
00067         float messageStatistics;                // Calculated message statistics
00068                 float errorStatistics;                  // Calculated error statistics
00069                 float messageIncrement;                 // Calculated increment of messages
00070                 float errorIncrement;                   // Calculated increment of logging errors
00071                 float actualStatisticsPeriod;   // Actual statistics calculation period
00072 
00073     public:
00074                 // Getter for disableStatistics
00075                 bool getDisableStatistics();
00076 
00077                 // Getter for statisticsIdentification
00078                 std::string getStatisticsIdentification();
00079 
00080         // Getter for accumulatedNumberOfMessages
00081                 uint32_t getAccumulatedNumberOfMessages();
00082 
00083         // Getter for accumaltedNumberOfLogErrors
00084                 uint32_t getAccumulatedNumberOfLogErrors();
00085 
00086         // Getter for statisticsGranularity
00087                 uint32_t getStatisticsGranularity();
00088 
00089         // Getter for lastPeriodNumberOfMessages
00090                 uint32_t getLastPeriodNumberOfMessages();
00091 
00092         // Getter for lastPeriodNumberOfLogErrors
00093                 uint32_t getLastPeriodNumberOfLogErrors();
00094 
00095         // Getter for lastStatisticsRepportTime
00096                 uint64_t getLastStatisticsRepportTime();
00097 
00098         // Getter for statisticsCalculationPeriod
00099                 uint32_t getStatisticsCalculationPeriod();
00100 
00101         // Setter for accumulatedNumberOfMessages
00102                 void setAccumulatedNumberOfMessages(uint32_t value);
00103 
00104                 // Setter for accumulatedNumberOfLogErrors
00105                 void setAccumulatedNumberOfLogErrors(uint32_t value);
00106 
00107                 // Setter for lastStatisticsRepportTime
00108                 void setLastStatisticsRepportTime(uint64_t value);
00109 
00110         // Setter for statisticsCalculationPeriod
00111                 void setStatisticsCalculationPeriod(uint32_t value);
00112 
00113         // Setter for statisticsGranularity
00114                 void setStatisticsGranularity(uint32_t value);
00115 
00116         // Setter for lastPeriodNumberOfMessages
00117                 void setLastPeriodNumberOfMessages(uint32_t value);
00118 
00119         // Setter for lastPeriodNumberOfMessages
00120                 void setLastPeriodNumberOfLogErrors(uint32_t value);
00121 
00122         // Statistics calculation getters
00123         float getMessageStatistics();
00124                 float getErrorStatistics();
00125                 float getMessageIncrement();
00126                 float getErrorIncrement();
00127                 float getActualStatisticsPeriod();
00128 
00129         // Default constructor
00130                 loggingStatistics();
00131 
00132         // Default destructor
00133         virtual ~loggingStatistics(){}
00134 
00139             virtual void
00140                 calculateLoggingStatistics();
00141 
00148                 virtual void
00149                 retrieveStatisticsLogs(std::list<std::string> &statisticsLogList,
00150                                const std::string loggerId);
00151 
00156                 virtual void incrementNumberOfMessages();
00157 
00162                 virtual void incrementNumberOfLogErrors();
00163 
00168                 virtual void resetStatistics();
00169 
00179                 virtual void configureStatistics(const std::string elementName,
00180                                                          const bool state,
00181                                                          const uint32_t period,
00182                                                          const uint32_t granularity);
00183 
00187                 static const uint32_t INITIAL_NUMBER_MESSAGES;
00188                 static const uint32_t INITIAL_NUMBER_ERRORS;
00189                 static const uint32_t DEFAULT_STATISTICS_PERIOD;
00190                 static const uint32_t DEFAULT_STATISTICS_GRANULARITY;
00191                 static const bool DEFAULT_STATISTICS_STATE;
00192 
00193                 };
00194 
00195 };
00196 
00197 #endif /*logging_statistics_H*/

Generated on Fri Jul 17 2015 12:58:44 for ACS-2015.6 C++ API by  doxygen 1.7.0