Sirikata
|
#include <Timer.hpp>
Public Member Functions | |
Timer () | |
~Timer () | |
void | start () |
Time | getTimerStarted () const |
Duration | elapsed () const |
Static Public Member Functions | |
static void | sleep (const Duration &dt) |
Sleep for approximately the given duration. | |
static void | setSystemClockOffset (const Duration &skew) |
static Duration | getSystemClockOffset () |
static Time | getSpecifiedDate (const std::string &datestring) |
static Duration | getUTCOffset () |
static String | nowAsString () |
Get the current local time as a string, e.g. | |
static String | nowUTCAsString () |
Get the current time, in UTC, as a string, e.g. | |
static Time | now () |
static Time | recentNow () |
Get the value returned by a recent call to now(). | |
static Duration | processElapsed () |
Get the (approximate) amount of time elapsed since the process started. | |
static Duration | recentProcessElapsed () |
Get the (approximate) amount of time elapsed since the process started based on a recent check of the timer. | |
Private Attributes | |
TimerImpl * | mStart |
Static Private Attributes | |
static Sirikata::AtomicValue < Duration > | sOffset |
Sirikata::Timer::Timer | ( | ) |
References mStart.
Sirikata::Timer::~Timer | ( | ) |
References mStart.
Duration Sirikata::Timer::elapsed | ( | ) | const |
Time Sirikata::Timer::getSpecifiedDate | ( | const std::string & | datestring | ) | [static] |
References Sirikata::Time::null().
Referenced by main(), and Sirikata::Trace::GraphiteTimeSeries::report().
Time Sirikata::Timer::getTimerStarted | ( | ) | const |
References mStart, Sirikata::Time::null(), and Sirikata::TimerImpl::val.
Duration Sirikata::Timer::getUTCOffset | ( | ) | [static] |
Referenced by Sirikata::Context::realTime(), and Sirikata::Context::recentRealTime().
Time Sirikata::Timer::now | ( | ) | [static] |
References Sirikata::Time::null(), Sirikata::AtomicValue< T >::read(), and sOffset.
Referenced by Sirikata::OH::SQLiteStorage::acquireLease(), Sirikata::OH::CassandraStorage::acquireLease(), Sirikata::AggregateManager::addChild(), Sirikata::DistributedCoordinateSegmentation::asyncLLRead(), Sirikata::Input::InputDevice::changeButton(), Sirikata::Network::IOStrand::dispatch(), Sirikata::TimeProfiler::Stage::finished(), Sirikata::Input::InputDevice::fireButton(), Sirikata::AggregateManager::generateAggregateMesh(), Sirikata::AggregateManager::generateAggregateMeshAsync(), Sirikata::AggregateManager::generateMeshesFromQueue(), Sirikata::CoordinateSegmentationClient::getLeasedSocket(), Sirikata::AggregateManager::handleUploadFinished(), Sirikata::AggregateManager::iRemoveChild(), main(), Sirikata::SST::Connection< EndPointType >::markAcknowledgedPacket(), Sirikata::AggregateManager::metadataFinished(), Sirikata::Network::IOStrand::post(), Sirikata::Network::IOService::post(), processElapsed(), Sirikata::OH::SQLiteStorage::processRenewals(), Sirikata::OH::CassandraStorage::processRenewals(), Sirikata::SST::Stream< EndPointType >::receiveData(), Sirikata::OH::SQLiteStorage::renewLease(), Sirikata::OH::CassandraStorage::renewLease(), Sirikata::CoordinateSegmentationClient::service(), Sirikata::SST::Connection< EndPointType >::serviceConnection(), Sirikata::SST::Stream< EndPointType >::serviceStream(), Sirikata::Context::simTime(), Sirikata::TimeProfiler::Stage::started(), and Sirikata::AggregateManager::uploadAggregateMesh().
String Sirikata::Timer::nowAsString | ( | ) | [static] |
Get the current local time as a string, e.g.
2002-Jan-01 10:00:01.123456789. Useful for reporting the real date when something happened.
Referenced by Sirikata::ReportVersion().
String Sirikata::Timer::nowUTCAsString | ( | ) | [static] |
Get the current time, in UTC, as a string, e.g.
2002-Jan-01 10:00:01.123456789. Useful for reporting the real date when something happened.
Duration Sirikata::Timer::processElapsed | ( | ) | [static] |
Get the (approximate) amount of time elapsed since the process started.
References now(), and Sirikata::AtomicValue< T >::read().
Time Sirikata::Timer::recentNow | ( | ) | [static] |
Get the value returned by a recent call to now().
Avoids the overhead of actually checking the time if you know something else is checking it frequently enough
References Sirikata::AtomicValue< T >::read().
Duration Sirikata::Timer::recentProcessElapsed | ( | ) | [static] |
Get the (approximate) amount of time elapsed since the process started based on a recent check of the timer.
This can be out of date, but is fairly accurate if you regularly check the time and much faster than processElapsed().
References Sirikata::AtomicValue< T >::read().
void Sirikata::Timer::setSystemClockOffset | ( | const Duration & | skew | ) | [static] |
References sOffset.
Referenced by Sirikata::TimeSync_sync_thread().
void Sirikata::Timer::sleep | ( | const Duration & | dt | ) | [static] |
Sleep for approximately the given duration.
Referenced by Sirikata::OH::CassandraStorage::acquireLease(), Sirikata::OH::SQLiteStorage::StorageAction::executeWithRetry(), Sirikata::OH::SQLitePersistedObjectSet::performUpdateWithRetry(), Sirikata::runMultiUnLoadSpeed(), Sirikata::runMultiUnLoadSpeedMulti(), Sirikata::NTPTimeSync::start(), Sirikata::Trace::Trace::storageThread(), and Sirikata::TimeSync_sync_thread().
void Sirikata::Timer::start | ( | ) |
References mStart, and Sirikata::TimerImpl::val.
Referenced by Sirikata::AsyncCraq::AsyncCraq(), Sirikata::CacheLRUOriginal::CacheLRUOriginal(), and Sirikata::Server::Server().
TimerImpl* Sirikata::Timer::mStart [private] |
Referenced by elapsed(), getTimerStarted(), start(), Timer(), and ~Timer().
Sirikata::AtomicValue< Duration > Sirikata::Timer::sOffset [static, private] |
Referenced by getSystemClockOffset(), now(), and setSystemClockOffset().