#include <FilesMonitorCollection.h>
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 &) | |
FilesMonitorCollection & | operator= (FilesMonitorCollection const &) |
Private Attributes | |
xdata::UnsignedInteger32 | closedFiles_ |
uint32_t | entryCounter_ |
FileRecordList | fileRecords_ |
boost::mutex | fileRecordsMutex_ |
const unsigned int | maxFileEntries_ |
xdata::UnsignedInteger32 | openFiles_ |
A collection of monitoring entities for open and closed files
Definition at line 31 of file FilesMonitorCollection.h.
typedef boost::circular_buffer<FileRecordPtr> stor::FilesMonitorCollection::FileRecordList |
Definition at line 78 of file FilesMonitorCollection.h.
typedef boost::shared_ptr<FileRecord> stor::FilesMonitorCollection::FileRecordPtr |
Definition at line 77 of file FilesMonitorCollection.h.
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] |
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] |
xdata::UnsignedInteger32 stor::FilesMonitorCollection::closedFiles_ [private] |
Definition at line 105 of file FilesMonitorCollection.h.
Referenced by do_appendInfoSpaceItems(), and do_updateInfoSpaceItems().
uint32_t stor::FilesMonitorCollection::entryCounter_ [private] |
Definition at line 103 of file FilesMonitorCollection.h.
Referenced by do_reset(), do_updateInfoSpaceItems(), and getNewFileRecord().
Definition at line 99 of file FilesMonitorCollection.h.
Referenced by do_reset(), do_updateInfoSpaceItems(), FilesMonitorCollection(), getFileRecords(), and getNewFileRecord().
boost::mutex stor::FilesMonitorCollection::fileRecordsMutex_ [mutable, private] |
Definition at line 100 of file FilesMonitorCollection.h.
Referenced by do_reset(), do_updateInfoSpaceItems(), FilesMonitorCollection(), getFileRecords(), 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().