mirror of https://github.com/aria2/aria2
2008-12-16 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed the bug that download progress summary is not printed in the interval specified by the option. * src/ConsoleStatCalc.cc * src/ConsoleStatCalc.hpull/1/head
parent
53151f7e91
commit
22d91f1729
|
@ -1,3 +1,10 @@
|
||||||
|
2008-12-16 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
|
Fixed the bug that download progress summary is not printed in the
|
||||||
|
interval specified by the option.
|
||||||
|
* src/ConsoleStatCalc.cc
|
||||||
|
* src/ConsoleStatCalc.h
|
||||||
|
|
||||||
2008-12-16 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
2008-12-16 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
Fixed compiler warning
|
Fixed compiler warning
|
||||||
|
|
|
@ -33,6 +33,22 @@
|
||||||
*/
|
*/
|
||||||
/* copyright --> */
|
/* copyright --> */
|
||||||
#include "ConsoleStatCalc.h"
|
#include "ConsoleStatCalc.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_TERMIOS_H
|
||||||
|
#include <termios.h>
|
||||||
|
#endif // HAVE_TERMIOS_H
|
||||||
|
#ifdef HAVE_SYS_IOCTL_H
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#endif // HAVE_SYS_IOCTL_H
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <iomanip>
|
||||||
|
#include <iostream>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <cstring>
|
||||||
|
#include <sstream>
|
||||||
|
#include <iterator>
|
||||||
|
|
||||||
#include "RequestGroupMan.h"
|
#include "RequestGroupMan.h"
|
||||||
#include "RequestGroup.h"
|
#include "RequestGroup.h"
|
||||||
#include "FileAllocationMan.h"
|
#include "FileAllocationMan.h"
|
||||||
|
@ -43,19 +59,6 @@
|
||||||
#ifdef ENABLE_BITTORRENT
|
#ifdef ENABLE_BITTORRENT
|
||||||
# include "BtContext.h"
|
# include "BtContext.h"
|
||||||
#endif // ENABLE_BITTORRENT
|
#endif // ENABLE_BITTORRENT
|
||||||
#ifdef HAVE_TERMIOS_H
|
|
||||||
#include <termios.h>
|
|
||||||
#endif // HAVE_TERMIOS_H
|
|
||||||
#ifdef HAVE_SYS_IOCTL_H
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#endif // HAVE_SYS_IOCTL_H
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <iomanip>
|
|
||||||
#include <iostream>
|
|
||||||
#include <algorithm>
|
|
||||||
#include <cstring>
|
|
||||||
#include <sstream>
|
|
||||||
#include <iterator>
|
|
||||||
|
|
||||||
namespace aria2 {
|
namespace aria2 {
|
||||||
|
|
||||||
|
@ -155,8 +158,7 @@ static void printProgressSummary(const std::deque<SharedHandle<RequestGroup> >&
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleStatCalc::ConsoleStatCalc(time_t summaryInterval):
|
ConsoleStatCalc::ConsoleStatCalc(time_t summaryInterval):
|
||||||
_summaryInterval(summaryInterval),
|
_summaryInterval(summaryInterval)
|
||||||
_summaryIntervalCount(0)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -168,7 +170,6 @@ ConsoleStatCalc::calculateStat(const RequestGroupManHandle& requestGroupMan,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_cp.reset();
|
_cp.reset();
|
||||||
++_summaryIntervalCount;
|
|
||||||
|
|
||||||
bool isTTY = isatty(STDOUT_FILENO) == 1;
|
bool isTTY = isatty(STDOUT_FILENO) == 1;
|
||||||
unsigned short int cols = 80;
|
unsigned short int cols = 80;
|
||||||
|
@ -183,9 +184,9 @@ ConsoleStatCalc::calculateStat(const RequestGroupManHandle& requestGroupMan,
|
||||||
}
|
}
|
||||||
std::ostringstream o;
|
std::ostringstream o;
|
||||||
if(requestGroupMan->countRequestGroup() > 0) {
|
if(requestGroupMan->countRequestGroup() > 0) {
|
||||||
if(_summaryInterval > 0 && _summaryIntervalCount%_summaryInterval == 0) {
|
if(_lastSummaryNotified.elapsed(_summaryInterval)) {
|
||||||
|
_lastSummaryNotified.reset();
|
||||||
printProgressSummary(requestGroupMan->getRequestGroups(), cols);
|
printProgressSummary(requestGroupMan->getRequestGroups(), cols);
|
||||||
_summaryIntervalCount = 0;
|
|
||||||
std::cout << "\n";
|
std::cout << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,9 +45,9 @@ class ConsoleStatCalc:public StatCalc
|
||||||
private:
|
private:
|
||||||
Time _cp;
|
Time _cp;
|
||||||
|
|
||||||
time_t _summaryInterval;
|
Time _lastSummaryNotified;
|
||||||
|
|
||||||
time_t _summaryIntervalCount;
|
time_t _summaryInterval;
|
||||||
public:
|
public:
|
||||||
ConsoleStatCalc(time_t summaryInterval);
|
ConsoleStatCalc(time_t summaryInterval);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue