2010-07-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Set milliseconds in DownloadEngine::refreshInterval_.  Because
	there is difference in accuracy between epoll and clock_gettime(),
	we set DEFAULT_REFRESH_INTERVAL 900ms just lower than default
	timeout 1 sec for epoll. Also set update interval of
	ConsoleStatCalc to 900ms by the same reason.
	* src/ConsoleStatCalc.cc
	* src/DownloadEngine.cc
	* src/DownloadEngine.h
pull/1/head
Tatsuhiro Tsujikawa 2010-07-28 12:31:55 +00:00
parent 27e96877b7
commit a21e375baa
4 changed files with 18 additions and 6 deletions

View File

@ -1,3 +1,14 @@
2010-07-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Set milliseconds in DownloadEngine::refreshInterval_. Because
there is difference in accuracy between epoll and clock_gettime(),
we set DEFAULT_REFRESH_INTERVAL 900ms just lower than default
timeout 1 sec for epoll. Also set update interval of
ConsoleStatCalc to 900ms by the same reason.
* src/ConsoleStatCalc.cc
* src/DownloadEngine.cc
* src/DownloadEngine.h
2010-07-27 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Rewritten check for fallocate using AC_COMPILE_IFELSE.

View File

@ -215,7 +215,7 @@ ConsoleStatCalc::ConsoleStatCalc(time_t summaryInterval, bool humanReadable):
void
ConsoleStatCalc::calculateStat(const DownloadEngine* e)
{
if(cp_.difference(global::wallclock) < 1) {
if(cp_.differenceInMillis(global::wallclock) < 900) {
return;
}
cp_ = global::wallclock;

View File

@ -143,7 +143,7 @@ void DownloadEngine::run()
cp.reset(0);
while(!commands_.empty() || !routineCommands_.empty()) {
global::wallclock.reset();
if(cp.difference(global::wallclock) >= refreshInterval_) {
if(cp.differenceInMillis(global::wallclock) >= refreshInterval_) {
refreshInterval_ = DEFAULT_REFRESH_INTERVAL;
cp = global::wallclock;
executeCommand(commands_, Command::STATUS_ALL);
@ -529,7 +529,7 @@ void DownloadEngine::setAuthConfigFactory
authConfigFactory_ = factory;
}
void DownloadEngine::setRefreshInterval(time_t interval)
void DownloadEngine::setRefreshInterval(int64_t interval)
{
refreshInterval_ = interval;
}

View File

@ -123,9 +123,10 @@ private:
bool noWait_;
static const time_t DEFAULT_REFRESH_INTERVAL = 1;
static const int64_t DEFAULT_REFRESH_INTERVAL = 900;
time_t refreshInterval_;
// Milliseconds
int64_t refreshInterval_;
std::deque<Command*> routineCommands_;
@ -337,7 +338,7 @@ public:
return authConfigFactory_;
}
void setRefreshInterval(time_t interval);
void setRefreshInterval(int64_t interval);
const std::string getSessionId() const
{