CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Attributes

edm::TimeoutPoolOutputModule Class Reference

#include <TimeoutPoolOutputModule.h>

Inheritance diagram for edm::TimeoutPoolOutputModule:
edm::PoolOutputModule edm::OutputModule

List of all members.

Public Member Functions

 TimeoutPoolOutputModule (ParameterSet const &ps)
virtual ~TimeoutPoolOutputModule ()

Protected Member Functions

virtual bool shouldWeCloseFile () const
 allow inheriting classes to override but still be able to call this method in the overridden version
virtual void write (EventPrincipal const &e)

Private Attributes

unsigned int eventsWrittenInCurrentFile
time_t m_lastEvent
int m_timeout

Detailed Description

Definition at line 21 of file TimeoutPoolOutputModule.h.


Constructor & Destructor Documentation

edm::TimeoutPoolOutputModule::TimeoutPoolOutputModule ( ParameterSet const &  ps) [explicit]

Definition at line 11 of file TimeoutPoolOutputModule.cc.

                                                                        :
      PoolOutputModule(ps), 
      m_lastEvent(time(NULL)),
      eventsWrittenInCurrentFile(0),
      m_timeout(-1) // we want the first event right away
  {  }
virtual edm::TimeoutPoolOutputModule::~TimeoutPoolOutputModule ( ) [inline, virtual]

Definition at line 24 of file TimeoutPoolOutputModule.h.

{};

Member Function Documentation

bool edm::TimeoutPoolOutputModule::shouldWeCloseFile ( ) const [protected, virtual]

allow inheriting classes to override but still be able to call this method in the overridden version

Reimplemented from edm::PoolOutputModule.

Definition at line 18 of file TimeoutPoolOutputModule.cc.

References edm::PoolOutputModule::currentFileName(), eventsWrittenInCurrentFile, m_lastEvent, m_timeout, cmsPerfSuiteHarvest::now, NULL, edm::PoolOutputModule::shouldWeCloseFile(), and cond::rpcobgas::time.

                                                        {
    time_t now(time(NULL));
    if ( PoolOutputModule::shouldWeCloseFile() ) {
      edm::LogVerbatim("TimeoutPoolOutputModule")  <<" Closing file "<< currentFileName()<< " with "<< eventsWrittenInCurrentFile  <<" events.";
      eventsWrittenInCurrentFile = 0;
      m_lastEvent = now;
      return true;
    }
    //    std::cout <<" Events "<< eventsWrittenInCurrentFile<<" time "<< now - m_lastEvent<<std::endl;
    if (eventsWrittenInCurrentFile==0) return false;
    if ( now - m_lastEvent < m_timeout ) return false;
    // next files are needed in 15, 30 and 60 sec
    m_lastEvent = now;
    if (m_timeout == 30) m_timeout = 60;
    if (m_timeout == 15) m_timeout = 30;
    if (m_timeout == -1) m_timeout = 15;
    
    edm::LogVerbatim("TimeoutPoolOutputModule")  <<" Closing file "<< currentFileName()<< " with "<< eventsWrittenInCurrentFile  <<" events.";
    eventsWrittenInCurrentFile = 0;
    return true;
  }
void edm::TimeoutPoolOutputModule::write ( EventPrincipal const &  e) [protected, virtual]

Member Data Documentation

Definition at line 31 of file TimeoutPoolOutputModule.h.

Referenced by shouldWeCloseFile(), and write().

time_t edm::TimeoutPoolOutputModule::m_lastEvent [mutable, private]

Definition at line 30 of file TimeoutPoolOutputModule.h.

Referenced by shouldWeCloseFile().

Definition at line 32 of file TimeoutPoolOutputModule.h.

Referenced by shouldWeCloseFile().