Browse Source

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
Tatsuhiro Tsujikawa 15 years ago
parent
commit
a21e375baa
4 changed files with 18 additions and 6 deletions
  1. 11 0
      ChangeLog
  2. 1 1
      src/ConsoleStatCalc.cc
  3. 2 2
      src/DownloadEngine.cc
  4. 4 3
      src/DownloadEngine.h

+ 11 - 0
ChangeLog

@@ -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.

+ 1 - 1
src/ConsoleStatCalc.cc

@@ -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;

+ 2 - 2
src/DownloadEngine.cc

@@ -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;
 }

+ 4 - 3
src/DownloadEngine.h

@@ -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
   {