ELstatistics

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
#ifndef FWCore_MessageService_ELstatistics_h
#define FWCore_MessageService_ELstatistics_h

// ----------------------------------------------------------------------
//
// ELstatistics	is a subclass of ELdestination representing the
//		provided statistics (for summary) keeping.
//
// 7/8/98 mf	Created file.
// 7/2/99 jvr   Added noTerminationSummary() function
// 12/20/99 mf  Added virtual destructor.
// 6/7/00 web	Reflect consolidation of ELdestination/X; consolidate
//		ELstatistics/X.
// 6/14/00 web	Declare classes before granting friendship.
// 10/4/00 mf   Add filterModule() and excludeModule()
// 1/15/00 mf   line length control: changed ELoutputLineLen to
//              the base class lineLen (no longer static const)
// 3/13/01 mf	statisticsMap()
//  4/4/01 mf   Removed moduleOfInterest and moduleToExclude, in favor
//              of using base class method.
// 1/17/06 mf	summary() for use in MessageLogger
// 8/16/07 mf	noteGroupedCategory(cat) to support grouping of modules in
//		specified categories.  Also, a static vector of such categories.
// 6/19/08 mf	summaryForJobReport() for use in CMS framework
//
// ----------------------------------------------------------------------

#include "FWCore/MessageLogger/interface/ELextendedID.h"
#include "FWCore/MessageLogger/interface/ELmap.h"
#include "FWCore/MessageService/src/ELdestination.h"
#include "FWCore/Utilities/interface/thread_safety_macros.h"

#include <set>

namespace edm {

  // ----------------------------------------------------------------------
  // prerequisite classes:
  // ----------------------------------------------------------------------

  class ErrorObj;
  namespace service {
    class ELadministrator;

    // ----------------------------------------------------------------------
    // ELstatistics:
    // ----------------------------------------------------------------------

    class ELstatistics : public ELdestination {
      friend class ELadministrator;

    public:
      // -----  constructor/destructor:
      ELstatistics();
      ELstatistics(std::ostream& osp);
      ELstatistics(int spaceLimit);
      ELstatistics(int spaceLimit, std::ostream& osp);
      ELstatistics(const ELstatistics& orig);
      ELstatistics& operator=(const ELstatistics& orig) = delete;  // verboten
      ~ELstatistics() override;

      // -----  Methods invoked by the ELadministrator:
      //
    public:
      // Used by attach() to put the destination on the ELadministrators list
      //-| There is a note in Design Notes about semantics
      //-| of copying a destination onto the list:  ofstream
      //-| ownership is passed to the new copy.

      bool log(const edm::ErrorObj& msg) override;

      // ----- Methods invoked by the MessageLoggerScribe, bypassing destControl
      //
    public:
      static void noteGroupedCategory(std::string const& cat);  // 8/16/07 mf

      void summary(unsigned long overfullWaitCount);
      void noTerminationSummary();
      void summaryForJobReport(std::map<std::string, double>& sm);
      void wipe() override;

    protected:
      void clearSummary();

      void zero() override;

      std::map<ELextendedID, StatsCount> statisticsMap() const;

    protected:
      int tableLimit;
      ELmap_stats stats;
      bool updatedStats;
      std::ostream& termStream;

      bool printAtTermination;

      CMS_THREAD_SAFE static std::set<std::string> groupedCategories;  // 8/16/07 mf
      static std::string formSummary(ELmap_stats& stats);              // 8/16/07 mf

      // ----  Helper methods specific to MessageLogger applicaton
      //
    private:
      std::string dualLogName(std::string const& s);

      void summary(std::ostream& os, std::string_view title);

    };  // ELstatistics

    // ----------------------------------------------------------------------

  }  // end of namespace service
}  // end of namespace edm

#endif  // FWCore_MessageService_ELstatistics_h