CMS 3D CMS Logo

Public Member Functions | Protected Attributes | Friends

edm::service::ELlimitsTable Class Reference

#include <ELlimitsTable.h>

List of all members.

Public Member Functions

bool add (const ELextendedID &xid)
 ELlimitsTable ()
ELlimitsTableoperator= (const ELlimitsTable &t)
void setInterval (const ELstring &id, int interval)
void setInterval (const ELseverityLevel &sev, int interval)
void setLimit (const ELseverityLevel &sev, int n)
void setLimit (const ELstring &id, int n)
void setTableLimit (int n)
void setTimespan (const ELstring &id, int n)
void setTimespan (const ELseverityLevel &sev, int n)
void wipe ()
void zero ()
 ~ELlimitsTable ()

Protected Attributes

ELmap_counts counts
ELmap_limits limits
int severityIntervals [ELseverityLevel::nLevels]
int severityLimits [ELseverityLevel::nLevels]
int severityTimespans [ELseverityLevel::nLevels]
int tableLimit
int wildcardInterval
int wildcardLimit
int wildcardTimespan

Friends

class ELdestination
class ELfwkJobReport
class ELoutput

Detailed Description

Definition at line 61 of file ELlimitsTable.h.


Constructor & Destructor Documentation

edm::service::ELlimitsTable::ELlimitsTable ( )

Definition at line 41 of file ELlimitsTable.cc.

References dtNoiseDBValidation_cfg::cerr, gen::k, edm::ELseverityLevel::nLevels, severityIntervals, severityLimits, and severityTimespans.

: wildcardLimit   ( -1 )
, wildcardInterval( -1 )
, wildcardTimespan( -1 )
, tableLimit      ( -1 )
, limits          (    )
, counts          (    )
{

#ifdef ELlimitsTableCONSTRUCTOR_TRACE
  std::cerr << "Constructor for ELlimitsTable\n";
#endif

  for ( int k = 0;  k < ELseverityLevel::nLevels;  ++k )  {
    severityLimits[k]    = -1;                // JvR 99-06-10
    severityIntervals[k]    = -1;             
    severityTimespans[k] = -1;
  }

}  // ELlimitsTable()
edm::service::ELlimitsTable::~ELlimitsTable ( )

Definition at line 63 of file ELlimitsTable.cc.

References dtNoiseDBValidation_cfg::cerr.

                               {

#ifdef ELlimitsTableCONSTRUCTOR_TRACE
  std::cerr << "Destructor for ELlimitsTable\n";
#endif

}  // ~ELlimitsTable()

Member Function Documentation

bool edm::service::ELlimitsTable::add ( const ELextendedID xid)

Definition at line 79 of file ELlimitsTable.cc.

References trackerHits::c, dtNoiseDBValidation_cfg::cerr, counts, edm::ELseverityLevel::getLevel(), edm::ELextendedID::id, prof2calltree::l, limits, edm::ELextendedID::severity, severityIntervals, severityLimits, severityTimespans, tableLimit, wildcardInterval, wildcardLimit, and wildcardTimespan.

Referenced by edm::service::ELfwkJobReport::log(), edm::service::ELerrorList::log(), edm::service::ELoutput::log(), and edm::service::ELcollected::log().

                                                   {

#ifdef ELlimitsTableATRACE
  std::cerr << "&&&--- adding to limits table: " << xid.id << '\n';
#endif

  ELmap_counts::iterator c = counts.find( xid );

  if ( c == counts.end() )  {  // no such entry yet

    #ifdef ELlimitsTableATRACE
    std::cerr << "&&&    no such entry yet in counts \n";
    #endif

    // if the counts table is "full", then this will never be rejected
    // and info will not be kept so why go through significant work: 
    if ( tableLimit > 0  && static_cast<int>(counts.size()) >= tableLimit ) {
      return true;
    }
    int lim;
    int ivl;
    int ts;
    ELmap_limits::iterator l = limits.find( xid.id );

    if ( l != limits.end() )  { // use limits previously established for this id
      lim = (*l).second.limit;
      ivl = (*l).second.interval;
      ts  = (*l).second.timespan;
      if ( lim < 0 )  {                                    // jvr 6/17/99
        lim = severityLimits[xid.severity.getLevel()];
        if ( lim < 0 )  {
          lim = wildcardLimit;
        }
      }
      if ( ivl < 0 )  {                                    
        ivl = severityIntervals[xid.severity.getLevel()];
        if ( ivl < 0 )  {
          ivl = wildcardInterval;                       // mf 11/02/07
        }
      }
      if ( ts < 0 )  {
        ts = severityTimespans[xid.severity.getLevel()];
        if (ts < 0 )  {
          ts = wildcardTimespan;
        }
        limits[xid.id] = LimitAndTimespan( lim, ts );
      }
      #ifdef ELlimitsTableATRACE
      std::cerr << "&&&    Entry found in limits: limit = " << lim
           << " interval = " << ivl
           << " timespan = " << ts << '\n';
      #endif
      // change log 9/29/10:  Do not put this into limits table
   } else  {   // establish and use limits new to this id
      lim = severityLimits   [xid.severity.getLevel()];
      ivl = severityIntervals[xid.severity.getLevel()];
      ts  = severityTimespans[xid.severity.getLevel()];
      #ifdef ELlimitsTableATRACE
      std::cerr << "&&&    Limit taken from severityLimits: " << lim << '\n'
           << "&&&    Interval taken from severityLimits: " << ivl << '\n';
      #endif
      if ( lim < 0 )  {
        lim = wildcardLimit;
        #ifdef ELlimitsTableATRACE
        std::cerr << "&&&    Limit reset to wildcard limit: " << lim << '\n';
        #endif
      }
      if ( ivl < 0 )  {
        ivl = wildcardInterval;
        #ifdef ELlimitsTableATRACE
        std::cerr << "&&&    Interval reset to wildcard interval: " << ivl << '\n';
        #endif
      }
      #ifdef ELlimitsTableATRACE
      std::cerr << "&&&    Timespan taken from severityTimespans: " << ts << '\n';
      #endif
      if ( ts < 0 )  {
        ts = wildcardTimespan;
        #ifdef ELlimitsTableATRACE
        std::cerr << "&&&    timespan reset to wildcard timespan: " << ts << '\n';
        #endif
      }

      // change log 9/29/10 DO not save id's future limits:
    }

    // save, if possible, this xid's initial entry:
    if ( tableLimit < 0  || static_cast<int>(counts.size()) < tableLimit )
      counts[xid] = CountAndLimit( lim, ts, ivl );
    c = counts.find( xid );
  }

  return  ( c == counts.end() )
        ? true               // no limit filtering can be applied
        : (*c).second.add()  // apply limit filtering
        ;

}  // add()
ELlimitsTable & edm::service::ELlimitsTable::operator= ( const ELlimitsTable t)

Definition at line 253 of file ELlimitsTable.cc.

References limits, edm::ELseverityLevel::nLevels, severityTimespans, wildcardLimit, and wildcardTimespan.

                                                                   {

  if(this == &t) {
    return  *this; // self assignment
  }
  limits = t.limits;  // The non-trivial operator= for a map!

  for ( int lev = 0;  lev < ELseverityLevel::nLevels;  ++lev )  {
    severityTimespans[lev] = t.severityTimespans[lev];
    severityTimespans[lev] = t.severityTimespans[lev];
  }

  wildcardLimit    = t.wildcardLimit;
  wildcardTimespan = t.wildcardTimespan;

  return  *this;

}  // operator=()
void edm::service::ELlimitsTable::setInterval ( const ELseverityLevel sev,
int  interval 
)

Definition at line 233 of file ELlimitsTable.cc.

References edm::ELseverityLevel::getLevel(), MergeJob_cfg::interval, and severityIntervals.

                                                                            {
  severityIntervals[sev.getLevel()] = interval;
}
void edm::service::ELlimitsTable::setInterval ( const ELstring id,
int  interval 
)

Definition at line 227 of file ELlimitsTable.cc.

References MergeJob_cfg::interval, limits, and wildcardInterval.

                                                                    {
  if ( id[0] == '*' )  wildcardInterval    = interval;
  else                 limits[id].interval = interval;
}
void edm::service::ELlimitsTable::setLimit ( const ELstring id,
int  n 
)

Definition at line 217 of file ELlimitsTable.cc.

References limits, n, and wildcardLimit.

                                                          {
  if ( id[0] == '*' )  wildcardLimit    = n;
  else                 limits[id].limit = n;
}
void edm::service::ELlimitsTable::setLimit ( const ELseverityLevel sev,
int  n 
)

Definition at line 223 of file ELlimitsTable.cc.

References edm::ELseverityLevel::getLevel(), n, and severityLimits.

                                                                  {
  severityLimits[sev.getLevel()] = n;
}
void edm::service::ELlimitsTable::setTableLimit ( int  n)

Definition at line 76 of file ELlimitsTable.cc.

References n, and tableLimit.

Referenced by edm::service::ELdestination::setTableLimit().

{ tableLimit = n; }
void edm::service::ELlimitsTable::setTimespan ( const ELseverityLevel sev,
int  n 
)

Definition at line 244 of file ELlimitsTable.cc.

References edm::ELseverityLevel::getLevel(), n, and severityTimespans.

                                                                     {
  severityTimespans[sev.getLevel()] = n;
}
void edm::service::ELlimitsTable::setTimespan ( const ELstring id,
int  n 
)

Definition at line 238 of file ELlimitsTable.cc.

References limits, n, and wildcardTimespan.

                                                             {
  if ( id[0] == '*' )  wildcardTimespan    = n;
  else                 limits[id].timespan = n;
}
void edm::service::ELlimitsTable::wipe ( )

Definition at line 183 of file ELlimitsTable.cc.

References counts, i, limits, edm::ELseverityLevel::nLevels, severityIntervals, severityLimits, severityTimespans, wildcardLimit, and wildcardTimespan.

Referenced by edm::service::ELdestination::wipe(), and edm::service::ELstatistics::wipe().

                          {
  // This clears everything -- counts and aggregate counts for severity levels
  // and for individual ID's, as well as any limits established, the limit
  // for "*" all messages, and the collection of severity defaults.  wipe()
  // does not not affect thresholds.

  limits.erase( limits.begin(), limits.end() );
  ELmap_counts::iterator i;
  for ( i = counts.begin();  i != counts.end();  ++i )  {
    (*i).second.limit = -1;
    (*i).second.n = (*i).second.aggregateN = 0;
  }

  wildcardLimit    = -1;
  wildcardTimespan = -1;
  for ( int lev = 0;  lev < ELseverityLevel::nLevels;  ++lev )  {
    severityLimits   [lev] = -1;
    severityIntervals[lev] = -1;
    severityTimespans[lev] = -1;
  }

}
void edm::service::ELlimitsTable::zero ( )

Definition at line 207 of file ELlimitsTable.cc.

References counts, and i.

Referenced by edm::service::ELstatistics::clearSummary(), edm::service::ELdestination::zero(), and edm::service::ELstatistics::zero().

                          {
  // This clears counts but not aggregate counts for severity levels
  // and for individual ID's.

  ELmap_counts::iterator i;
  for ( i = counts.begin();  i != counts.end();  ++i )
    (*i).second.n = 0;
}

Friends And Related Function Documentation

friend class ELdestination [friend]

Definition at line 63 of file ELlimitsTable.h.

friend class ELfwkJobReport [friend]

Definition at line 65 of file ELlimitsTable.h.

friend class ELoutput [friend]

Definition at line 64 of file ELlimitsTable.h.


Member Data Documentation

Definition at line 107 of file ELlimitsTable.h.

Referenced by add(), wipe(), and zero().

Definition at line 106 of file ELlimitsTable.h.

Referenced by add(), operator=(), setInterval(), setLimit(), setTimespan(), and wipe().

int edm::service::ELlimitsTable::severityIntervals[ELseverityLevel::nLevels] [protected]

Definition at line 100 of file ELlimitsTable.h.

Referenced by add(), ELlimitsTable(), setInterval(), and wipe().

int edm::service::ELlimitsTable::severityLimits[ELseverityLevel::nLevels] [protected]

Definition at line 98 of file ELlimitsTable.h.

Referenced by add(), ELlimitsTable(), setLimit(), and wipe().

int edm::service::ELlimitsTable::severityTimespans[ELseverityLevel::nLevels] [protected]

Definition at line 99 of file ELlimitsTable.h.

Referenced by add(), ELlimitsTable(), operator=(), setTimespan(), and wipe().

Definition at line 105 of file ELlimitsTable.h.

Referenced by add(), and setTableLimit().

Definition at line 102 of file ELlimitsTable.h.

Referenced by add(), and setInterval().

Definition at line 101 of file ELlimitsTable.h.

Referenced by add(), operator=(), setLimit(), and wipe().

Definition at line 103 of file ELlimitsTable.h.

Referenced by add(), operator=(), setTimespan(), and wipe().