Classes | |
struct | ptrComp |
Typedefs | |
typedef boost::posix_time::time_duration | Duration_t |
typedef boost::posix_time::ptime | TimePoint_t |
Functions | |
std::string | asctimeUTC (TimePoint_t) |
void | checkDirectory (const std::string &) |
std::string | dateStamp (TimePoint_t) |
double | durationToSeconds (Duration_t const &) |
TimePoint_t | getCurrentTime () |
std::string | getIdentifier (xdaq::ApplicationDescriptor *) |
void | getStdVector (xdata::Vector< xdata::String > &, std::vector< std::string > &) |
void | getXdataVector (const std::vector< std::string > &, xdata::Vector< xdata::String > &) |
long | secondsSinceEpoch (TimePoint_t const &) |
Duration_t | secondsToDuration (double const &seconds) |
void | sleep (Duration_t) |
void | sleepUntil (TimePoint_t) |
std::string | timeStamp (TimePoint_t) |
std::string | timeStampUTC (TimePoint_t) |
typedef boost::posix_time::time_duration stor::utils::Duration_t |
typedef boost::posix_time::ptime stor::utils::TimePoint_t |
std::string stor::utils::asctimeUTC | ( | TimePoint_t | theTime | ) |
Converts a TimePoint_t into a string containing the time in UTC formatted as "Www Mmm dd hh:mm:ss yyyy"
Definition at line 49 of file Utils.cc.
References plotBeamSpotDB::ptm.
{ tm ptm = to_tm(theTime); char buf[30]; asctime_r(&ptm, buf); std::ostringstream dateStampStr; dateStampStr << buf << " UTC"; return dateStampStr.str(); }
void stor::utils::checkDirectory | ( | const std::string & | path | ) |
Throws a stor::exception::NoSuchDirectory when the directory does not exist
Definition at line 80 of file Utils.cc.
References lumiQueryAPI::msg, and python::entryComment::results.
Referenced by stor::FileHandler::checkDirectories(), and stor::DbFileHandler::openFile().
{ #if linux struct stat64 results; int retVal = stat64(path.c_str(), &results); #else struct stat results; int retVal = stat(path.c_str(), &results); #endif if( retVal != 0 ) { std::ostringstream msg; msg << "Directory " << path << " does not exist: " << strerror(errno); XCEPT_RAISE(stor::exception::NoSuchDirectory, msg.str()); } if ( !(results.st_mode & S_IWUSR) ) { std::ostringstream msg; msg << "Directory " << path << " is not writable."; XCEPT_RAISE(stor::exception::NoSuchDirectory, msg.str()); } }
std::string stor::utils::dateStamp | ( | TimePoint_t | theTime | ) |
Converts a TimePoint_t into a string containing only the date. Note: the string formatting is used for file db log file name
Definition at line 60 of file Utils.cc.
References plotBeamSpotDB::ptm.
Referenced by stor::DbFileHandler::openFile().
{ typedef boost::date_time::c_local_adjustor<boost::posix_time::ptime> local_adj; tm ptm = boost::posix_time::to_tm( local_adj::utc_to_local(theTime) ); std::ostringstream dateStampStr; dateStampStr << std::setfill('0') << std::setw(4) << ptm.tm_year+1900 << std::setfill('0') << std::setw(2) << ptm.tm_mon+1 << std::setfill('0') << std::setw(2) << ptm.tm_mday; return dateStampStr.str(); }
double stor::utils::durationToSeconds | ( | Duration_t const & | duration | ) | [inline] |
Convert a boost::posix_time::time_duration into fractional seconds with a resolution of milliseconds.
Definition at line 147 of file Utils.h.
Referenced by stor::ThroughputMonitorCollection::addDiskWriterIdleSample(), stor::ThroughputMonitorCollection::addDQMEventProcessorIdleSample(), stor::ThroughputMonitorCollection::addFragmentProcessorIdleSample(), smproxy::SMPSWebPageHelper::addRowForEventServer(), stor::ThroughputMonitorCollection::calcBusyPercentage(), stor::MonitoredQuantity::calculateStatistics(), stor::ThroughputMonitorCollection::do_updateInfoSpaceItems(), stor::RegistrationInfoBase::getPSet(), stor::ThroughputMonitorCollection::getRateAndBandwidth(), stor::RegistrationInfoBase::lastContactSecondsAgo(), stor::Configuration::setupDiskWritingInfoSpaceParams(), smproxy::Configuration::setupQueueConfigurationInfoSpaceParams(), stor::Configuration::setupWorkerThreadInfoSpaceParams(), and stor::ThroughputMonitorCollection::smoothIdleTimesHelper().
{ return static_cast<double>(duration.total_milliseconds()) / 1000; }
TimePoint_t stor::utils::getCurrentTime | ( | ) | [inline] |
Returns the current point in time.
Definition at line 158 of file Utils.h.
Referenced by stor::DQMTopLevelFolder::addDQMEvent(), stor::QueueCollection< T >::addEvent(), stor::detail::ChainData::addFirstFragment(), stor::MonitoredQuantity::addSample(), stor::detail::ChainData::addToChain(), stor::StatisticsReporter::calculateStatistics(), smproxy::StatisticsReporter::calculateStatistics(), stor::DiskWriter::checkForFileTimeOuts(), smproxy::DataManager::checkForStaleConsumers(), stor::EventDistributor::checkForStaleConsumers(), stor::RegistrationInfoBase::consumerContact(), stor::ExpirableQueue< T, Policy >::deqNowait(), FittedEntriesSet::FittedEntriesSet(), stor::FragmentStore::getStaleEvent(), smproxy::StatisticsReporter::monitorAction(), stor::StatisticsReporter::monitorAction(), stor::DQMEventProcessor::processNextDQMEvent(), stor::FragmentProcessor::processOneFragment(), stor::FragmentProcessor::processOneFragmentIfPossible(), stor::StatisticsReporter::reset(), smproxy::StatisticsReporter::reset(), stor::detail::ChainData::resetStaleWindowStartTime(), stor::StatisticsReporter::startWorkLoop(), smproxy::StatisticsReporter::startWorkLoop(), stor::EventDistributor::tagCompleteEventForQueues(), stor::DbFileHandler::write(), stor::FileHandler::writeEvent(), stor::EventFileHandler::writeHeader(), and stor::DiskWriter::writeNextEvent().
{
return boost::posix_time::ptime(boost::posix_time::microsec_clock::universal_time());
}
std::string stor::utils::getIdentifier | ( | xdaq::ApplicationDescriptor * | appDesc | ) |
Returns an identifier string composed of class name and instance
Definition at line 72 of file Utils.cc.
Referenced by stor::FragmentProcessor::startWorkLoop(), stor::StatisticsReporter::startWorkLoop(), stor::DQMEventProcessor::startWorkLoop(), stor::DiskWriter::startWorkLoop(), and smproxy::StatisticsReporter::startWorkLoop().
{ std::ostringstream identifier; identifier << appDesc->getClassName() << appDesc->getInstance() << "/"; return identifier.str(); }
void stor::utils::getStdVector | ( | xdata::Vector< xdata::String > & | x, |
std::vector< std::string > & | s | ||
) |
Conversions between std::vector<std::string> and xdata::Vector<xdata::String>
Definition at line 105 of file Utils.cc.
Referenced by smproxy::Configuration::updateLocalDataRetrieverData(), and stor::Configuration::updateLocalDiskWritingData().
void stor::utils::getXdataVector | ( | const std::vector< std::string > & | v, |
xdata::Vector< xdata::String > & | x | ||
) |
Definition at line 119 of file Utils.cc.
Referenced by smproxy::Configuration::setupDataRetrieverInfoSpaceParams(), and stor::Configuration::setupDiskWritingInfoSpaceParams().
long stor::utils::secondsSinceEpoch | ( | TimePoint_t const & | timestamp | ) | [inline] |
Return the number of seconds since the unix epoch 1-1-1970
Definition at line 152 of file Utils.h.
Referenced by stor::DbFileHandler::addReportHeader(), stor::FileHandler::insertFileInDatabase(), and stor::FileHandler::updateDatabase().
{ const static boost::posix_time::ptime epoch(boost::gregorian::date(1970,1,1)); return (timestamp - epoch).total_seconds(); }
Duration_t stor::utils::secondsToDuration | ( | double const & | seconds | ) | [inline] |
Convert a fractional second count into a boost::posix_time::time_duration type with a resolution of milliseconds.
Definition at line 140 of file Utils.h.
References seconds().
Referenced by stor::RegistrationInfoBase::RegistrationInfoBase(), stor::ThroughputMonitorCollection::smoothIdleTimesHelper(), stor::Configuration::updateLocalDiskWritingData(), smproxy::Configuration::updateLocalQueueConfigurationData(), and stor::Configuration::updateLocalWorkerThreadData().
{ const unsigned int fullSeconds = static_cast<unsigned int>(seconds); return boost::posix_time::seconds(fullSeconds) + boost::posix_time::millisec(static_cast<unsigned int>((seconds - fullSeconds)*1000) ); }
void stor::utils::sleep | ( | Duration_t | interval | ) | [inline] |
Sleep for at least the given duration. Note that the underlying system will round the interval up to an integer multiple of the system's sleep resolution.
Definition at line 163 of file Utils.h.
Referenced by evf::ExceptionGenerator::analyze(), EcalBarrelMonitorDbModule::analyze(), HLXMonitor::analyze(), EcalEndcapMonitorDbModule::analyze(), HLXMonitor::beginJob(), smproxy::DataManager::checkForStaleConsumers(), RFIOFile::close(), evf::FUResourceQueue::discard(), evf::FUResourceQueue::discardWhileHalting(), evf::rb_statemachine::Halting::do_stateAction(), evf::FUEventProcessor::doEndRunInEDM(), smproxy::DQMArchiver::doIt(), stor::ResourceMonitorCollection::doStatFs(), evf::rb_statemachine::Stopping::emergencyStop(), evf::FUEventProcessor::enableClassic(), evf::FUEventProcessor::enableCommon(), evf::FUEventProcessor::enableMPEPSlave(), evf::FUEventProcessor::enabling(), cond::ExportIOVUtilities::execute(), cond::AlignSplitIOV::execute(), evf::iDie::fsmCallback(), pos::PixelConfigFile::getConfig(), stor::EventServerProxy< RegInfo >::getInitMsgFromEventServer(), WatcherStreamFileReader::getInputFile(), evf::RawCache::getMsgToWrite(), evf::FUEventProcessor::handleSignalSlave(), HcalSimHitStudy::HcalSimHitStudy(), evf::rb_statemachine::CommandQueue::lock(), evf::BU::monitoring(), evf::rb_statemachine::SharedResources::monitoring(), evf::FWEPWrapper::monitoring(), LmfSource::openFile(), stor::FragmentProcessor::processOneFragmentIfPossible(), evf::Vulture::prowling(), evf::FUShmClient::readNext(), evf::FUEventProcessor::receivingAndMonitor(), evf::FUShmBuffer::releaseSharedMemory(), RFIOFile::reopen(), RFIOFile::retryRead(), evf::FUResourceQueue::sendData(), evf::FUResourceQueue::sendDataWhileHalting(), evf::FUResourceQueue::sendDqm(), evf::FUResourceQueue::sendDqmWhileHalting(), SimHitsValidationHcal::SimHitsValidationHcal(), sleepUntil(), evf::BU::stopping(), evf::FUEventProcessor::subWeb(), evf::FUEventProcessor::summarize(), evf::FUEventProcessor::supervisor(), ora::OraDatabaseSchema::testDropPermission(), evf::rb_statemachine::SharedResources::watching(), ZDCDigiStudy::ZDCDigiStudy(), and ZdcSimHitStudy::ZdcSimHitStudy().
void stor::utils::sleepUntil | ( | TimePoint_t | theTime | ) | [inline] |
Sleep until at least the given TimePoint_t.
Definition at line 168 of file Utils.h.
References sleep().
Referenced by smproxy::StatisticsReporter::monitorAction(), and stor::StatisticsReporter::monitorAction().
{ boost::this_thread::sleep(theTime); }
std::string stor::utils::timeStamp | ( | TimePoint_t | theTime | ) |
Converts a TimePoint_t into a string. Note: the string formatting is used by the file summary catalog and may or may not depend on the actual formatting
Definition at line 23 of file Utils.cc.
References plotBeamSpotDB::ptm.
Referenced by MatacqTBDataFormatter::printData(), evf::FUShmBuffer::setEvtTimeStamp(), MatacqRawEvent::setRawData(), and SiPixelPerformanceSummary::setTimeStamp().
{ typedef boost::date_time::c_local_adjustor<boost::posix_time::ptime> local_adj; tm ptm = boost::posix_time::to_tm( local_adj::utc_to_local(theTime) ); std::ostringstream timeStampStr; timeStampStr << std::setfill('0') << std::setw(2) << ptm.tm_mday << "/" << std::setfill('0') << std::setw(2) << ptm.tm_mon+1 << "/" << std::setfill('0') << std::setw(4) << ptm.tm_year+1900 << ":" << std::setfill('0') << std::setw(2) << ptm.tm_hour << "/" << std::setfill('0') << std::setw(2) << ptm.tm_min << "/" << std::setfill('0') << std::setw(2) << ptm.tm_sec; return timeStampStr.str(); }
std::string stor::utils::timeStampUTC | ( | TimePoint_t | theTime | ) |
Converts a TimePoint_t into a string containg only the time in UTC.
Definition at line 38 of file Utils.cc.
References plotBeamSpotDB::ptm.
Referenced by stor::SMWebPageHelper::addRowForThroughputStatistics().
{ tm ptm = to_tm(theTime); std::ostringstream timeStampStr; timeStampStr << std::setfill('0') << std::setw(2) << ptm.tm_hour << ":" << std::setfill('0') << std::setw(2) << ptm.tm_min << ":" << std::setfill('0') << std::setw(2) << ptm.tm_sec; return timeStampStr.str(); }