CMS 3D CMS Logo

edm::MessageLoggerQ Class Reference

#include <FWCore/MessageLogger/interface/MessageLoggerQ.h>

List of all members.

Public Types

enum  OpCode {
  END_THREAD, LOG_A_MESSAGE, CONFIGURE, EXTERN_DEST,
  SUMMARIZE, JOBREPORT, JOBMODE, SHUT_UP,
  FLUSH_LOG_Q, GROUP_STATS, FJR_SUMMARY
}

Static Public Member Functions

static void consume (OpCode &opcode, void *&operand)
static MessageLoggerQinstance ()
static void MLqCFG (ParameterSet *p)
static void MLqEND ()
static void MLqEXT (service::NamedDestination *p)
static void MLqFLS ()
static void MLqGRP (std::string *cat_p)
static void MLqJOB (std::string *j)
static void MLqJRS (std::map< std::string, double > *sum_p)
static void MLqLOG (ErrorObj *p)
static void MLqMOD (std::string *jm)
static void MLqSHT ()
static void MLqSUM ()

Private Member Functions

 MessageLoggerQ (MessageLoggerQ const &)
 MessageLoggerQ ()
void operator= (MessageLoggerQ const &)
 ~MessageLoggerQ ()

Static Private Attributes

static SingleConsumerQ buf
static const int buf_depth = 500
static const int buf_size


Detailed Description

Definition at line 20 of file MessageLoggerQ.h.


Member Enumeration Documentation

enum edm::MessageLoggerQ::OpCode

Enumerator:
END_THREAD 
LOG_A_MESSAGE 
CONFIGURE 
EXTERN_DEST 
SUMMARIZE 
JOBREPORT 
JOBMODE 
SHUT_UP 
FLUSH_LOG_Q 
GROUP_STATS 
FJR_SUMMARY 

Definition at line 24 of file MessageLoggerQ.h.

00025   { END_THREAD     // END
00026   , LOG_A_MESSAGE  // LOG
00027   , CONFIGURE      // CFG
00028   , EXTERN_DEST    // EXT
00029   , SUMMARIZE      // SUM
00030   , JOBREPORT      // JOB
00031   , JOBMODE        // MOD
00032   , SHUT_UP        // SHT
00033   , FLUSH_LOG_Q    // FLS
00034   , GROUP_STATS    // GRP
00035   , FJR_SUMMARY    // JRS
00036   };  // OpCode


Constructor & Destructor Documentation

MessageLoggerQ::MessageLoggerQ (  )  [private]

Definition at line 39 of file MessageLoggerQ.cc.

Referenced by instance().

00040 { }

MessageLoggerQ::~MessageLoggerQ (  )  [private]

Definition at line 43 of file MessageLoggerQ.cc.

00044 { }

edm::MessageLoggerQ::MessageLoggerQ ( MessageLoggerQ const &   )  [private]


Member Function Documentation

void MessageLoggerQ::consume ( OpCode opcode,
void *&  operand 
) [static]

Definition at line 189 of file MessageLoggerQ.cc.

References b, buf, buf_size, edm::SingleConsumerQ::OperateBuffer< T >::buffer(), and edm::SingleConsumerQ::OperateBuffer< T >::commit().

Referenced by edm::service::MessageLoggerScribe::configure_errorlog(), and edm::service::MessageLoggerScribe::run().

00190 {
00191   SingleConsumerQ::ConsumerBuffer b(buf);
00192   char * slot_p = static_cast<char *>(b.buffer());
00193 
00194   std::memcpy(&opcode , slot_p+0             , sizeof(OpCode));
00195   std::memcpy(&operand, slot_p+sizeof(OpCode), sizeof(void *));
00196   b.commit(buf_size);
00197 }  // MessageLoggerQ::consume()

MessageLoggerQ * MessageLoggerQ::instance ( void   )  [static]

Definition at line 48 of file MessageLoggerQ.cc.

References MessageLoggerQ().

00049 {
00050   static MessageLoggerQ *  instance = new MessageLoggerQ();
00051   return instance;
00052 }  // MessageLoggerQ::instance()

void MessageLoggerQ::MLqCFG ( ParameterSet p  )  [static]

Definition at line 98 of file MessageLoggerQ.cc.

References b, buf, buf_size, edm::SingleConsumerQ::OperateBuffer< T >::buffer(), edm::ConfigurationHandshake::c, TestMuL1L2Filter_cff::cerr, edm::SingleConsumerQ::OperateBuffer< T >::commit(), CONFIGURE, edm::ConfigurationHandshake::epp, h, edm::ConfigurationHandshake::m, sl, v, and cms::Exception::what().

Referenced by edm::service::MessageLogger::MessageLogger().

00099 {
00100   Place_for_passing_exception_ptr epp = new Pointer_to_new_exception_on_heap(0);
00101   ConfigurationHandshake h((void*)p,epp);
00102   SingleConsumerQ::ProducerBuffer b(buf);
00103   char * slot_p = static_cast<char *>(b.buffer());
00104 
00105   OpCode o(CONFIGURE);
00106   void * v(static_cast<void *>(&h));
00107 
00108   std::memcpy(slot_p+0             , &o, sizeof(OpCode));
00109   std::memcpy(slot_p+sizeof(OpCode), &v, sizeof(void *));
00110   Pointer_to_new_exception_on_heap ep;
00111   {
00112     boost::mutex::scoped_lock sl(h.m);       // get lock
00113     b.commit(buf_size);
00114     // wait for result to appear (in epp)
00115     h.c.wait(sl); // c.wait(sl) unlocks the scoped lock and sleeps till notified
00116     // ... and once the MessageLoggerScribe does h.c.notify_all() ... 
00117     ep = *h.epp;
00118     // finally, release the scoped lock by letting it go out of scope 
00119   }
00120   if ( ep ) {
00121     edm::Exception ex(*ep);
00122     delete ep;
00123     ex << "\n The preceding exception was thrown in MessageLoggerScribe\n";
00124     ex << "and forwarded to the main thread from the Messages thread.";
00125     std::cerr << "exception from MessageLoggerQ::CFG - exception what() is \n" 
00126                 << ex.what(); 
00127     throw ex;
00128   }  
00129 }  // MessageLoggerQ::CFG()

void MessageLoggerQ::MLqEND (  )  [static]

Definition at line 55 of file MessageLoggerQ.cc.

References b, buf, buf_size, edm::SingleConsumerQ::OperateBuffer< T >::buffer(), edm::SingleConsumerQ::OperateBuffer< T >::commit(), END_THREAD, and v.

Referenced by edm::service::MessageServicePresence::~MessageServicePresence().

00056 {
00057   SingleConsumerQ::ProducerBuffer b(buf);
00058   char * slot_p = static_cast<char *>(b.buffer());
00059 
00060   OpCode o(END_THREAD);
00061   void * v(0);
00062 
00063   std::memcpy(slot_p               , &o, sizeof(OpCode));
00064   std::memcpy(slot_p+sizeof(OpCode), &v, sizeof(void *));
00065   b.commit(buf_size);
00066 }  // MessageLoggerQ::END()

void MessageLoggerQ::MLqEXT ( service::NamedDestination p  )  [static]

Definition at line 132 of file MessageLoggerQ.cc.

References b, buf, buf_size, edm::SingleConsumerQ::OperateBuffer< T >::buffer(), edm::SingleConsumerQ::OperateBuffer< T >::commit(), EXTERN_DEST, and v.

Referenced by ML::MLlog4cplus::MLlog4cplus().

00133 {
00134   SingleConsumerQ::ProducerBuffer b(buf);
00135   char * slot_p = static_cast<char *>(b.buffer());
00136 
00137   OpCode o(EXTERN_DEST);
00138   void * v(static_cast<void *>(p));
00139 
00140   std::memcpy(slot_p+0             , &o, sizeof(OpCode));
00141   std::memcpy(slot_p+sizeof(OpCode), &v, sizeof(void *));
00142   b.commit(buf_size);  
00143 }

void MessageLoggerQ::MLqFLS (  )  [static]

Definition at line 200 of file MessageLoggerQ.cc.

References b, buf, buf_size, edm::SingleConsumerQ::OperateBuffer< T >::buffer(), edm::ConfigurationHandshake::c, edm::SingleConsumerQ::OperateBuffer< T >::commit(), FLUSH_LOG_Q, h, edm::ConfigurationHandshake::m, p, sl, and v.

Referenced by edm::FlushMessageLog().

00201 {
00202   // The ConfigurationHandshake, developed for synchronous CFG, contains a
00203   // place to convey exception information.  FLS does not need this, nor does
00204   // it need the parameter set, but we are reusing ConfigurationHandshake 
00205   // rather than reinventing the mechanism.
00206   Place_for_passing_exception_ptr epp = new Pointer_to_new_exception_on_heap(0);
00207   ParameterSet * p = 0;
00208   ConfigurationHandshake h(p,epp);
00209   SingleConsumerQ::ProducerBuffer b(buf);
00210   char * slot_p = static_cast<char *>(b.buffer());
00211 
00212   OpCode o(FLUSH_LOG_Q);
00213   void * v(static_cast<void *>(&h));
00214 
00215   std::memcpy(slot_p+0             , &o, sizeof(OpCode));
00216   std::memcpy(slot_p+sizeof(OpCode), &v, sizeof(void *));
00217   {
00218     boost::mutex::scoped_lock sl(h.m);       // get lock
00219     b.commit(buf_size);
00220     // wait for result to appear (in epp)
00221     h.c.wait(sl); // c.wait(sl) unlocks the scoped lock and sleeps till notified
00222     // ... and once the MessageLoggerScribe does h.c.notify_all() ... 
00223     // finally, release the scoped lock by letting it go out of scope 
00224   }
00225 }  // MessageLoggerQ::FLS()

void MessageLoggerQ::MLqGRP ( std::string *  cat_p  )  [static]

Definition at line 228 of file MessageLoggerQ.cc.

References b, buf, buf_size, edm::SingleConsumerQ::OperateBuffer< T >::buffer(), edm::SingleConsumerQ::OperateBuffer< T >::commit(), GROUP_STATS, and v.

Referenced by edm::GroupLogStatistics().

00229 {
00230   SingleConsumerQ::ProducerBuffer b(buf);
00231   char * slot_p = static_cast<char *>(b.buffer());
00232 
00233   OpCode o(GROUP_STATS);
00234   void * v(static_cast<void *>(cat_p));
00235 
00236   std::memcpy(slot_p+0             , &o, sizeof(OpCode));
00237   std::memcpy(slot_p+sizeof(OpCode), &v, sizeof(void *));
00238   b.commit(buf_size);
00239 }  // MessageLoggerQ::GRP()

void MessageLoggerQ::MLqJOB ( std::string *  j  )  [static]

Definition at line 160 of file MessageLoggerQ.cc.

References b, buf, buf_size, edm::SingleConsumerQ::OperateBuffer< T >::buffer(), edm::SingleConsumerQ::OperateBuffer< T >::commit(), JOBREPORT, and v.

Referenced by edm::service::MessageLogger::MessageLogger().

00161 {
00162   SingleConsumerQ::ProducerBuffer b(buf);
00163   char * slot_p = static_cast<char *>(b.buffer());
00164 
00165   OpCode o(JOBREPORT);
00166   void * v(static_cast<void *>(j));
00167 
00168   std::memcpy(slot_p+0             , &o, sizeof(OpCode));
00169   std::memcpy(slot_p+sizeof(OpCode), &v, sizeof(void *));
00170   b.commit(buf_size);
00171 }  // MessageLoggerQ::JOB()

void MessageLoggerQ::MLqJRS ( std::map< std::string, double > *  sum_p  )  [static]

Definition at line 242 of file MessageLoggerQ.cc.

References b, buf, buf_size, edm::SingleConsumerQ::OperateBuffer< T >::buffer(), edm::ConfigurationHandshake::c, TestMuL1L2Filter_cff::cerr, edm::SingleConsumerQ::OperateBuffer< T >::commit(), edm::ConfigurationHandshake::epp, FJR_SUMMARY, h, edm::ConfigurationHandshake::m, sl, v, and cms::Exception::what().

Referenced by edm::service::MessageLogger::SummarizeInJobReport().

00243 {
00244   Place_for_passing_exception_ptr epp = new Pointer_to_new_exception_on_heap(0);
00245   ConfigurationHandshake h((void*)sum_p,epp);
00246   SingleConsumerQ::ProducerBuffer b(buf);
00247   char * slot_p = static_cast<char *>(b.buffer());
00248 
00249   OpCode o(FJR_SUMMARY);
00250   void * v(static_cast<void *>(&h));
00251 
00252   std::memcpy(slot_p+0             , &o, sizeof(OpCode));
00253   std::memcpy(slot_p+sizeof(OpCode), &v, sizeof(void *));
00254   Pointer_to_new_exception_on_heap ep;
00255   {
00256     boost::mutex::scoped_lock sl(h.m);       // get lock
00257     b.commit(buf_size);
00258     // wait for result to appear (in epp)
00259     h.c.wait(sl); // c.wait(sl) unlocks the scoped lock and sleeps till notified
00260     // ... and once the MessageLoggerScribe does h.c.notify_all() ... 
00261     ep = *h.epp;
00262     // finally, release the scoped lock by letting it go out of scope 
00263   }
00264   if ( ep ) {
00265     edm::Exception ex(*ep);
00266     delete ep;
00267     ex << "\n The preceding exception was thrown in MessageLoggerScribe\n";
00268     ex << "and forwarded to the main thread from the Messages thread.\n";
00269     std::cerr << "exception from MessageLoggerQ::JRS - exception what() is \n" 
00270                 << ex.what(); 
00271     throw ex;
00272   }  
00273 }  // MessageLoggerQ::CFG()

void MessageLoggerQ::MLqLOG ( ErrorObj p  )  [static]

Definition at line 83 of file MessageLoggerQ.cc.

References b, buf, buf_size, edm::SingleConsumerQ::OperateBuffer< T >::buffer(), edm::SingleConsumerQ::OperateBuffer< T >::commit(), LOG_A_MESSAGE, and v.

Referenced by edm::MessageSender::~MessageSender().

00084 {
00085   SingleConsumerQ::ProducerBuffer b(buf);
00086   char * slot_p = static_cast<char *>(b.buffer());
00087 
00088   OpCode o(LOG_A_MESSAGE);
00089   void * v(static_cast<void *>(p));
00090 
00091   std::memcpy(slot_p+0             , &o, sizeof(OpCode));
00092   std::memcpy(slot_p+sizeof(OpCode), &v, sizeof(void *));
00093   b.commit(buf_size);
00094 }  // MessageLoggerQ::LOG()

void MessageLoggerQ::MLqMOD ( std::string *  jm  )  [static]

Definition at line 174 of file MessageLoggerQ.cc.

References b, buf, buf_size, edm::SingleConsumerQ::OperateBuffer< T >::buffer(), edm::SingleConsumerQ::OperateBuffer< T >::commit(), JOBMODE, and v.

Referenced by edm::service::MessageLogger::MessageLogger().

00175 {
00176   SingleConsumerQ::ProducerBuffer b(buf);
00177   char * slot_p = static_cast<char *>(b.buffer());
00178 
00179   OpCode o(JOBMODE);
00180   void * v(static_cast<void *>(jm));
00181 
00182   std::memcpy(slot_p+0             , &o, sizeof(OpCode));
00183   std::memcpy(slot_p+sizeof(OpCode), &v, sizeof(void *));
00184   b.commit(buf_size);
00185 }  // MessageLoggerQ::MOD()

void MessageLoggerQ::MLqSHT (  )  [static]

Definition at line 69 of file MessageLoggerQ.cc.

References b, buf, buf_size, edm::SingleConsumerQ::OperateBuffer< T >::buffer(), edm::SingleConsumerQ::OperateBuffer< T >::commit(), SHUT_UP, and v.

Referenced by edm::HaltMessageLogging().

00070 {
00071   SingleConsumerQ::ProducerBuffer b(buf);
00072   char * slot_p = static_cast<char *>(b.buffer());
00073 
00074   OpCode o(SHUT_UP);
00075   void * v(0);
00076 
00077   std::memcpy(slot_p               , &o, sizeof(OpCode));
00078   std::memcpy(slot_p+sizeof(OpCode), &v, sizeof(void *));
00079   b.commit(buf_size);
00080 }  // MessageLoggerQ::SHT()

void MessageLoggerQ::MLqSUM (  )  [static]

Definition at line 146 of file MessageLoggerQ.cc.

References b, buf, buf_size, edm::SingleConsumerQ::OperateBuffer< T >::buffer(), edm::SingleConsumerQ::OperateBuffer< T >::commit(), SUMMARIZE, and v.

Referenced by edm::LogStatistics(), and edm::service::MessageLogger::postEndJob().

00147 {
00148   SingleConsumerQ::ProducerBuffer b(buf);
00149   char * slot_p = static_cast<char *>(b.buffer());
00150 
00151   OpCode o(SUMMARIZE);
00152   void * v(0);
00153 
00154   std::memcpy(slot_p               , &o, sizeof(OpCode));
00155   std::memcpy(slot_p+sizeof(OpCode), &v, sizeof(void *));
00156   b.commit(buf_size);
00157 }  // MessageLoggerQ::SUM()

void edm::MessageLoggerQ::operator= ( MessageLoggerQ const &   )  [private]


Member Data Documentation

SingleConsumerQ MessageLoggerQ::buf [static, private]

Definition at line 72 of file MessageLoggerQ.h.

Referenced by consume(), MLqCFG(), MLqEND(), MLqEXT(), MLqFLS(), MLqGRP(), MLqJOB(), MLqJRS(), MLqLOG(), MLqMOD(), MLqSHT(), and MLqSUM().

const int edm::MessageLoggerQ::buf_depth = 500 [static, private]

Definition at line 67 of file MessageLoggerQ.h.

const int edm::MessageLoggerQ::buf_size [static, private]

Initial value:

 sizeof(OpCode)
                               + sizeof(void *)

Definition at line 68 of file MessageLoggerQ.h.

Referenced by consume(), MLqCFG(), MLqEND(), MLqEXT(), MLqFLS(), MLqGRP(), MLqJOB(), MLqJRS(), MLqLOG(), MLqMOD(), MLqSHT(), and MLqSUM().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:41:48 2009 for CMSSW by  doxygen 1.5.4