Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-30 02:33:06

0001 #ifndef FWCore_MessageService_ELstatistics_h
0002 #define FWCore_MessageService_ELstatistics_h
0003 
0004 // ----------------------------------------------------------------------
0005 //
0006 // ELstatistics is a subclass of ELdestination representing the
0007 //      provided statistics (for summary) keeping.
0008 //
0009 // 7/8/98 mf    Created file.
0010 // 7/2/99 jvr   Added noTerminationSummary() function
0011 // 12/20/99 mf  Added virtual destructor.
0012 // 6/7/00 web   Reflect consolidation of ELdestination/X; consolidate
0013 //      ELstatistics/X.
0014 // 6/14/00 web  Declare classes before granting friendship.
0015 // 10/4/00 mf   Add filterModule() and excludeModule()
0016 // 1/15/00 mf   line length control: changed ELoutputLineLen to
0017 //              the base class lineLen (no longer static const)
0018 // 3/13/01 mf   statisticsMap()
0019 //  4/4/01 mf   Removed moduleOfInterest and moduleToExclude, in favor
0020 //              of using base class method.
0021 // 1/17/06 mf   summary() for use in MessageLogger
0022 // 8/16/07 mf   noteGroupedCategory(cat) to support grouping of modules in
0023 //      specified categories.  Also, a static vector of such categories.
0024 // 6/19/08 mf   summaryForJobReport() for use in CMS framework
0025 //
0026 // ----------------------------------------------------------------------
0027 
0028 #include "FWCore/MessageLogger/interface/ELextendedID.h"
0029 #include "FWCore/MessageLogger/interface/ELmap.h"
0030 #include "FWCore/MessageService/src/ELdestination.h"
0031 #include "FWCore/Utilities/interface/thread_safety_macros.h"
0032 
0033 #include <set>
0034 
0035 namespace edm {
0036 
0037   // ----------------------------------------------------------------------
0038   // prerequisite classes:
0039   // ----------------------------------------------------------------------
0040 
0041   class ErrorObj;
0042   namespace service {
0043     class ELadministrator;
0044 
0045     // ----------------------------------------------------------------------
0046     // ELstatistics:
0047     // ----------------------------------------------------------------------
0048 
0049     class ELstatistics : public ELdestination {
0050       friend class ELadministrator;
0051 
0052     public:
0053       // -----  constructor/destructor:
0054       ELstatistics();
0055       ELstatistics(std::ostream& osp);
0056       ELstatistics(int spaceLimit);
0057       ELstatistics(int spaceLimit, std::ostream& osp);
0058       ELstatistics(const ELstatistics& orig);
0059       ELstatistics& operator=(const ELstatistics& orig) = delete;  // verboten
0060       ~ELstatistics() override;
0061 
0062       // -----  Methods invoked by the ELadministrator:
0063       //
0064     public:
0065       // Used by attach() to put the destination on the ELadministrators list
0066       //-| There is a note in Design Notes about semantics
0067       //-| of copying a destination onto the list:  ofstream
0068       //-| ownership is passed to the new copy.
0069 
0070       bool log(const edm::ErrorObj& msg) override;
0071 
0072       // ----- Methods invoked by the MessageLoggerScribe, bypassing destControl
0073       //
0074     public:
0075       static void noteGroupedCategory(std::string const& cat);  // 8/16/07 mf
0076 
0077       void summary(unsigned long overfullWaitCount);
0078       void noTerminationSummary();
0079       void summaryForJobReport(std::map<std::string, double>& sm);
0080       void wipe() override;
0081 
0082     protected:
0083       void clearSummary();
0084 
0085       void zero() override;
0086 
0087       std::map<ELextendedID, StatsCount> statisticsMap() const;
0088 
0089     protected:
0090       int tableLimit;
0091       ELmap_stats stats;
0092       bool updatedStats;
0093       std::ostream& termStream;
0094 
0095       bool printAtTermination;
0096 
0097       CMS_THREAD_SAFE static std::set<std::string> groupedCategories;  // 8/16/07 mf
0098       static std::string formSummary(ELmap_stats& stats);              // 8/16/07 mf
0099 
0100       // ----  Helper methods specific to MessageLogger applicaton
0101       //
0102     private:
0103       std::string dualLogName(std::string const& s);
0104 
0105       void summary(std::ostream& os, std::string_view title);
0106 
0107     };  // ELstatistics
0108 
0109     // ----------------------------------------------------------------------
0110 
0111   }  // end of namespace service
0112 }  // end of namespace edm
0113 
0114 #endif  // FWCore_MessageService_ELstatistics_h