CMS 3D CMS Logo

Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes

stor::FilesMonitorCollection Class Reference

#include <FilesMonitorCollection.h>

Inheritance diagram for stor::FilesMonitorCollection:
stor::MonitorCollection

List of all members.

Classes

struct  FileRecord

Public Types

typedef boost::circular_buffer
< FileRecordPtr
FileRecordList
typedef boost::shared_ptr
< FileRecord
FileRecordPtr

Public Member Functions

 FilesMonitorCollection (const utils::Duration_t &updateInterval)
void getFileRecords (FileRecordList &) const
const FileRecordPtr getNewFileRecord ()

Private Member Functions

virtual void do_appendInfoSpaceItems (InfoSpaceItems &)
virtual void do_calculateStatistics ()
virtual void do_reset ()
virtual void do_updateInfoSpaceItems ()
 FilesMonitorCollection (FilesMonitorCollection const &)
FilesMonitorCollectionoperator= (FilesMonitorCollection const &)

Private Attributes

xdata::UnsignedInteger32 closedFiles_
uint32_t entryCounter_
FileRecordList fileRecords_
boost::mutex fileRecordsMutex_
const unsigned int maxFileEntries_
xdata::UnsignedInteger32 openFiles_

Detailed Description

A collection of monitoring entities for open and closed files

Author:
mommsen
Revision:
1.17
Date:
2011/07/07 09:22:44

Definition at line 31 of file FilesMonitorCollection.h.


Member Typedef Documentation

Definition at line 78 of file FilesMonitorCollection.h.

Definition at line 77 of file FilesMonitorCollection.h.


Constructor & Destructor Documentation

stor::FilesMonitorCollection::FilesMonitorCollection ( const utils::Duration_t updateInterval) [explicit]

Definition at line 14 of file FilesMonitorCollection.cc.

References fileRecords_, fileRecordsMutex_, and maxFileEntries_.

                                                                                      :
  MonitorCollection(updateInterval),
  maxFileEntries_(250),
  entryCounter_(0)
  {
    boost::mutex::scoped_lock sl(fileRecordsMutex_);
    fileRecords_.set_capacity(maxFileEntries_);
  }
stor::FilesMonitorCollection::FilesMonitorCollection ( FilesMonitorCollection const &  ) [private]

Member Function Documentation

void stor::FilesMonitorCollection::do_appendInfoSpaceItems ( InfoSpaceItems infoSpaceItems) [private, virtual]

Reimplemented from stor::MonitorCollection.

Definition at line 59 of file FilesMonitorCollection.cc.

References closedFiles_, and openFiles_.

  {
    infoSpaceItems.push_back(std::make_pair("openFiles", &openFiles_));
    infoSpaceItems.push_back(std::make_pair("closedFiles", &closedFiles_));
  }
void stor::FilesMonitorCollection::do_calculateStatistics ( ) [private, virtual]

Implements stor::MonitorCollection.

Definition at line 45 of file FilesMonitorCollection.cc.

  {
    // nothing to do
  }
void stor::FilesMonitorCollection::do_reset ( ) [private, virtual]

Implements stor::MonitorCollection.

Definition at line 51 of file FilesMonitorCollection.cc.

References entryCounter_, fileRecords_, and fileRecordsMutex_.

  {
    boost::mutex::scoped_lock sl(fileRecordsMutex_);
    fileRecords_.clear();
    entryCounter_ = 0;
  }
void stor::FilesMonitorCollection::do_updateInfoSpaceItems ( ) [private, virtual]

Reimplemented from stor::MonitorCollection.

Definition at line 66 of file FilesMonitorCollection.cc.

References closedFiles_, entryCounter_, fileRecords_, fileRecordsMutex_, and openFiles_.

  {
    boost::mutex::scoped_lock sl(fileRecordsMutex_);
    
    openFiles_ = 0;
    
    for (
      FileRecordList::const_iterator it = fileRecords_.begin(),
        itEnd = fileRecords_.end();
      it != itEnd;
      ++it
    )
    {
      if ( (*it)->isOpen )
        ++openFiles_;
    }
    
    closedFiles_ = entryCounter_ - openFiles_;
  }
void stor::FilesMonitorCollection::getFileRecords ( FileRecordList fileRecords) const

Definition at line 38 of file FilesMonitorCollection.cc.

References fileRecords_, and fileRecordsMutex_.

Referenced by stor::SMWebPageHelper::addDOMforFiles().

  {
    boost::mutex::scoped_lock sl(fileRecordsMutex_);
    fileRecords = fileRecords_;
  }
const FilesMonitorCollection::FileRecordPtr stor::FilesMonitorCollection::getNewFileRecord ( )

Definition at line 25 of file FilesMonitorCollection.cc.

References entryCounter_, fileRecords_, and fileRecordsMutex_.

  {
    boost::mutex::scoped_lock sl(fileRecordsMutex_);
    
    boost::shared_ptr<FileRecord> fileRecord(new FilesMonitorCollection::FileRecord());
    fileRecord->entryCounter = entryCounter_++;
    fileRecord->fileSize = 0;
    fileRecord->eventCount = 0;
    fileRecord->adler32 = 0;
    fileRecords_.push_back(fileRecord);
    return fileRecord;
  }
FilesMonitorCollection& stor::FilesMonitorCollection::operator= ( FilesMonitorCollection const &  ) [private]

Member Data Documentation

xdata::UnsignedInteger32 stor::FilesMonitorCollection::closedFiles_ [private]

Definition at line 105 of file FilesMonitorCollection.h.

Referenced by do_appendInfoSpaceItems(), and do_updateInfoSpaceItems().

Definition at line 103 of file FilesMonitorCollection.h.

Referenced by do_reset(), do_updateInfoSpaceItems(), and getNewFileRecord().

const unsigned int stor::FilesMonitorCollection::maxFileEntries_ [private]

Definition at line 102 of file FilesMonitorCollection.h.

Referenced by FilesMonitorCollection().

xdata::UnsignedInteger32 stor::FilesMonitorCollection::openFiles_ [private]

Definition at line 106 of file FilesMonitorCollection.h.

Referenced by do_appendInfoSpaceItems(), and do_updateInfoSpaceItems().