本文整理汇总了C++中LLTimer类的典型用法代码示例。如果您正苦于以下问题:C++ LLTimer类的具体用法?C++ LLTimer怎么用?C++ LLTimer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LLTimer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateQueue
S32 LLQueuedThread::updateQueue(U32 max_time_ms)
{
F64 max_time = (F64)max_time_ms * .001;
LLTimer timer;
S32 pending = 1;
// Frame Update
if (mThreaded)
{
pending = getPending();
if(pending > 0)
{
unpause();
}
}
else
{
while (pending > 0)
{
pending = processNextRequest();
if (max_time && timer.getElapsedTimeF64() > max_time)
break;
}
}
return pending;
}
示例2: set_test_name
void object::test<5>()
{
set_test_name("bad type");
LLSD request;
request["uri"] = uri;
request["method"] = "getdict";
request["reply"] = "reply";
(void)request["params"];
// Set up a timeout filter so we don't spin forever waiting.
LLEventTimeout watchdog;
// Connect the timeout filter to the reply pump.
LLTempBoundListener temp(
pumps.obtain("reply").
listen("watchdog", boost::bind(&LLEventTimeout::post, boost::ref(watchdog), _1)));
// Now connect our target listener to the timeout filter.
watchdog.listen("captureReply", boost::bind(&data::captureReply, this, _1));
// Kick off the request...
reply.clear();
pumps.obtain("LLXMLRPCTransaction").post(request);
// Set the timer
F32 timeout(10);
watchdog.eventAfter(timeout, LLSD().insert("timeout", 0));
// and pump "mainloop" until we get something, whether from
// LLXMLRPCListener or from the watchdog filter.
LLTimer timer;
F32 start = timer.getElapsedTimeF32();
LLEventPump& mainloop(pumps.obtain("mainloop"));
while (reply.isUndefined())
{
mainloop.post(LLSD());
}
ensure("timeout works", (timer.getElapsedTimeF32() - start) < (timeout + 1));
ensure_equals(reply["status"].asString(), "BadType");
ensure_contains("bad type", reply["responses"]["nested_dict"].asString(), "bad XMLRPC type");
}
示例3: pump_loop
F32 pump_loop(LLPumpIO* pump, F32 seconds)
{
LLTimer timer;
timer.setTimerExpirySec(seconds);
while(!timer.hasExpired())
{
LLFrameTimer::updateFrameTime();
pump->pump();
pump->callback();
}
return timer.getElapsedTimeF32();
}
示例4: update
//static
void LLMarketplaceInventoryImporter::update()
{
if (instanceExists())
{
static LLTimer update_timer;
if (update_timer.hasExpired())
{
LLMarketplaceInventoryImporter::instance().updateImport();
//static LLCachedControl<F32> MARKET_IMPORTER_UPDATE_FREQUENCY("MarketImporterUpdateFreq", 1.0f);
update_timer.setTimerExpirySec(MARKET_IMPORTER_UPDATE_FREQUENCY);
}
}
}
示例5: updateCloudScrolling
void LLWLParamSet::updateCloudScrolling(void)
{
static LLTimer s_cloud_timer;
F64 delta_t = s_cloud_timer.getElapsedTimeAndResetF64();
if(getEnableCloudScrollX())
{
mCloudScrollXOffset += F32(delta_t * (getCloudScrollX() - 10.f) / 100.f);
}
if(getEnableCloudScrollY())
{
mCloudScrollYOffset += F32(delta_t * (getCloudScrollY() - 10.f) / 100.f);
}
}
示例6: draw
void LLProgressBar::draw()
{
static LLTimer timer;
F32 alpha = getDrawContext().mAlpha;
LLColor4 image_bar_color = mColorBackground.get();
image_bar_color.setAlpha(alpha);
mImageBar->draw(getLocalRect(), image_bar_color);
alpha *= 0.5f + 0.5f*0.5f*(1.f + (F32)sin(3.f*timer.getElapsedTimeF32()));
LLColor4 bar_color = mColorBar.get();
bar_color.mV[VALPHA] *= alpha; // modulate alpha
LLRect progress_rect = getLocalRect();
progress_rect.mRight = llround(getRect().getWidth() * (mPercentDone / 100.f));
mImageFill->draw(progress_rect, bar_color);
}
示例7: init
namespace etw
{
HMODULE hETW;
tpLogFrame pLogFrame;
tpLogStartTask pLogStartTask;
tpLogEndTask pLogEndTask;
tpLogTickTask pLogTickTask;
LLTimer etwFrameTimer;
void init()
{
pLogFrame = NULL;
pLogStartTask = NULL;
pLogEndTask = NULL;
pLogTickTask = NULL;
// This is okay for now. We'll only need that for measuring under well defined circumstances.
// Maybe create an installer for this one day (very low prio) that copies and registers the provider.
hETW = ::LoadLibrary( L"c:\\xperf\\fs_etw.dll" );
if( hETW )
{
tpInitialize pInitialize = reinterpret_cast< tpInitialize>( ::GetProcAddress( hETW, "initialize" ) );
if( pInitialize && (*pInitialize)() )
{
pLogFrame = reinterpret_cast< tpLogFrame >( ::GetProcAddress( hETW, "log_beginFrame" ) );
pLogStartTask = reinterpret_cast< tpLogStartTask >( ::GetProcAddress( hETW, "log_startTask" ) );
pLogEndTask = reinterpret_cast< tpLogEndTask >( ::GetProcAddress( hETW, "log_endTask" ) );
pLogTickTask = reinterpret_cast< tpLogTickTask >( ::GetProcAddress( hETW, "log_tickTask" ) );
etwFrameTimer.reset();
}
}
}
}
示例8: timeDelay
void timeDelay(LLCoros::self& self, LLPanelMarketplaceOutbox* outboxPanel)
{
waitForEventOn(self, "mainloop");
LLTimer delayTimer;
delayTimer.reset();
delayTimer.setTimerExpirySec(5.0f);
while (!delayTimer.hasExpired())
{
waitForEventOn(self, "mainloop");
}
outboxPanel->onSyncComplete();
gTimeDelayDebugFunc = "";
}
示例9: timeout
/*virtual*/ void completed(U32 status, const std::string& reason, const LLSD& content)
{
slmGetTimer.stop();
if (gSavedSettings.getBOOL("InventoryOutboxLogging"))
{
llinfos << " SLM GET status: " << status << llendl;
llinfos << " SLM GET reason: " << reason << llendl;
llinfos << " SLM GET content: " << content.asString() << llendl;
llinfos << " SLM GET timer: " << slmGetTimer.getElapsedTimeF32() << llendl;
}
if ((status == MarketplaceErrorCodes::IMPORT_AUTHENTICATION_ERROR) ||
(status == MarketplaceErrorCodes::IMPORT_JOB_TIMEOUT))
{
if (gSavedSettings.getBOOL("InventoryOutboxLogging"))
{
llinfos << " SLM GET clearing marketplace cookie due to authentication failure or timeout (" << status << " / " << reason << ")." << llendl;
}
sMarketplaceCookie.clear();
}
sImportInProgress = (status == MarketplaceErrorCodes::IMPORT_PROCESSING);
sImportGetPending = false;
sImportResultStatus = status;
sImportResults = content;
}
示例10: if
/*virtual*/ void completed(U32 status, const std::string& reason, const LLSD& content)
{
slmGetTimer.stop();
if (gSavedSettings.getBOOL("InventoryOutboxLogging"))
{
llinfos << " SLM GET status: " << status << llendl;
llinfos << " SLM GET reason: " << reason << llendl;
llinfos << " SLM GET content: " << content.asString() << llendl;
llinfos << " SLM GET timer: " << slmGetTimer.getElapsedTimeF32() << llendl;
}
// MAINT-2452 : Do not clear the cookie on IMPORT_DONE_WITH_ERRORS
if ((status >= MarketplaceErrorCodes::IMPORT_BAD_REQUEST) &&
(status != MarketplaceErrorCodes::IMPORT_DONE_WITH_ERRORS))
{
if (gSavedSettings.getBOOL("InventoryOutboxLogging"))
{
llinfos << " SLM GET clearing marketplace cookie due to client or server error (" << status << " / " << reason << ")." << llendl;
}
sMarketplaceCookie.clear();
}
else if (gSavedSettings.getBOOL("InventoryOutboxLogging") && (status == MarketplaceErrorCodes::IMPORT_DONE_WITH_ERRORS))
{
llinfos << " SLM GET : Got IMPORT_DONE_WITH_ERRORS, marketplace cookie not cleared." << llendl;
}
sImportInProgress = (status == MarketplaceErrorCodes::IMPORT_PROCESSING);
sImportGetPending = false;
sImportResultStatus = status;
sImportResults = content;
}
示例11: if
/*virtual*/ void completed(U32 status, const std::string& reason, const LLSD& content)
{
slmGetTimer.stop();
if (gSavedSettings.getBOOL("InventoryOutboxLogging"))
{
llinfos << " SLM GET status: " << status << llendl;
llinfos << " SLM GET reason: " << reason << llendl;
llinfos << " SLM GET content: " << content.asString() << llendl;
llinfos << " SLM GET timer: " << slmGetTimer.getElapsedTimeF32() << llendl;
}
// MAINT-2452 : Do not clear the cookie on IMPORT_DONE_WITH_ERRORS : Happens when trying to import objects with wrong permissions
// ACME-1221 : Do not clear the cookie on IMPORT_NOT_FOUND : Happens for newly created Merchant accounts that are initially empty
if ((status >= MarketplaceErrorCodes::IMPORT_BAD_REQUEST) &&
(status != MarketplaceErrorCodes::IMPORT_DONE_WITH_ERRORS) &&
(status != MarketplaceErrorCodes::IMPORT_NOT_FOUND))
{
if (gSavedSettings.getBOOL("InventoryOutboxLogging"))
{
llinfos << " SLM GET clearing marketplace cookie due to client or server error (" << status << " / " << reason << ")." << llendl;
}
sMarketplaceCookie.clear();
}
else if (gSavedSettings.getBOOL("InventoryOutboxLogging") && (status >= MarketplaceErrorCodes::IMPORT_BAD_REQUEST))
{
llinfos << " SLM GET : Got error status = " << status << ", but marketplace cookie not cleared." << llendl;
}
sImportInProgress = (status == MarketplaceErrorCodes::IMPORT_PROCESSING);
sImportGetPending = false;
sImportResultStatus = status;
sImportResults = content;
}
示例12: onMainLoop
bool LLUpdaterServiceImpl::onMainLoop(LLSD const & event)
{
if(mTimer.getStarted() && mTimer.hasExpired())
{
stopTimer();
// Check for failed install.
if(LLFile::isfile(ll_install_failed_marker_path()))
{
int requiredValue = 0;
{
llifstream stream(ll_install_failed_marker_path());
stream >> requiredValue;
if(stream.fail()) requiredValue = 0;
}
// TODO: notify the user.
llinfos << "found marker " << ll_install_failed_marker_path() << llendl;
llinfos << "last install attempt failed" << llendl;
LLFile::remove(ll_install_failed_marker_path());
LLSD event;
event["type"] = LLSD(LLUpdaterService::INSTALL_ERROR);
event["required"] = LLSD(requiredValue);
LLEventPumps::instance().obtain(LLUpdaterService::pumpName()).post(event);
setState(LLUpdaterService::TERMINAL);
}
else
{
示例13: restartTimer
void LLUpdaterServiceImpl::restartTimer(unsigned int seconds)
{
LL_INFOS("UpdaterService") << "will check for update again in " <<
seconds << " seconds" << LL_ENDL;
mTimer.start();
mTimer.setTimerExpirySec((F32)seconds);
LLEventPumps::instance().obtain("mainloop").listen(
sListenerName, boost::bind(&LLUpdaterServiceImpl::onMainLoop, this, _1));
}
示例14: onMainLoop
bool LLUpdaterServiceImpl::onMainLoop(LLSD const & event)
{
if(mTimer.getStarted() && mTimer.hasExpired())
{
stopTimer();
// Check for failed install.
if(LLFile::isfile(ll_install_failed_marker_path()))
{
LL_DEBUGS("UpdaterService") << "found marker " << ll_install_failed_marker_path() << LL_ENDL;
int requiredValue = 0;
{
llifstream stream(ll_install_failed_marker_path().c_str());
stream >> requiredValue;
if(stream.fail())
{
requiredValue = 0;
}
}
// TODO: notify the user.
LL_WARNS("UpdaterService") << "last install attempt failed" << LL_ENDL;;
LLFile::remove(ll_install_failed_marker_path());
LLSD event;
event["type"] = LLSD(LLUpdaterService::INSTALL_ERROR);
event["required"] = LLSD(requiredValue);
LLEventPumps::instance().obtain(LLUpdaterService::pumpName()).post(event);
setState(LLUpdaterService::TERMINAL);
}
//<FS:TM> 3.6.4 check this, commented out to compile
//else
//{
// std::string query_url = LLGridManager::getInstance()->getUpdateServiceURL();
// if ( !query_url.empty() )
// {
// mUpdateChecker.checkVersion(query_url, mChannel, mVersion,
// mPlatform, mPlatformVersion, mUniqueId,
// mWillingToTest);
// setState(LLUpdaterService::CHECKING_FOR_UPDATE);
// }
// else
// {
// LL_WARNS("UpdaterService")
// << "No updater service defined for grid '" << LLGridManager::getInstance()->getGrid()
// << "' will check again in " << mCheckPeriod << " seconds"
// << LL_ENDL;
// // Because the grid can be changed after the viewer is started (when the first check takes place)
// // but before the user logs in, the next check may be on a different grid, so set the retry timer
// // even though this check did not happen. The default time is once an hour, and if we're not
// // doing the check anyway the performance impact is completely insignificant.
// restartTimer(mCheckPeriod);
// }
//}
}
示例15: haveTrackingInfo
bool LLTrackingData::haveTrackingInfo()
{
LLViewerObject* object = gObjectList.findObject(mAvatarID);
if(object && !object->isDead())
{
mCoarseLocationTimer.checkExpirationAndReset(COARSE_FREQUENCY);
mUpdateTimer.setTimerExpirySec(FIND_FREQUENCY);
mAgentGone.setTimerExpirySec(OFFLINE_SECONDS);
mHaveInfo = true;
return true;
}
if(mHaveCoarseInfo &&
!mCoarseLocationTimer.checkExpirationAndReset(COARSE_FREQUENCY))
{
// if we reach here, then we have a 'recent' coarse update
mUpdateTimer.setTimerExpirySec(FIND_FREQUENCY);
mAgentGone.setTimerExpirySec(OFFLINE_SECONDS);
return true;
}
if(mUpdateTimer.checkExpirationAndReset(FIND_FREQUENCY))
{
LLAvatarTracker::instance().findAgent();
mHaveCoarseInfo = false;
}
if(mAgentGone.checkExpirationAndReset(OFFLINE_SECONDS))
{
mHaveInfo = false;
mHaveCoarseInfo = false;
}
return mHaveInfo;
}