summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKostyantyn Ovechko <fastinetserver@gmail.com>2010-07-27 03:00:12 +0300
committerKostyantyn Ovechko <fastinetserver@gmail.com>2010-07-27 03:00:12 +0300
commit34836d823dd07ebca6c2d473dc427d638992630d (patch)
tree71e7c36373ec020ff40a2b68bf4333804b17b3cc
parentAdd log and error_log windows to tuiclient (diff)
downloadidfetch-34836d823dd07ebca6c2d473dc427d638992630d.tar.gz
idfetch-34836d823dd07ebca6c2d473dc427d638992630d.tar.bz2
idfetch-34836d823dd07ebca6c2d473dc427d638992630d.zip
Add segments counters to stats and tui.
-rw-r--r--segget/distfile.cpp2
-rw-r--r--segget/stats.cpp2
-rw-r--r--segget/stats.h6
3 files changed, 9 insertions, 1 deletions
diff --git a/segget/distfile.cpp b/segget/distfile.cpp
index ba5778d..04777f3 100644
--- a/segget/distfile.cpp
+++ b/segget/distfile.cpp
@@ -274,6 +274,7 @@ void Tdistfile::split_into_segments(){
segment_size=size;
segments_count=1;
};
+ stats.segments_count+=segments_count;
dn_segments = new Tsegment [segments_count];
//none downloaded yet
for (uint segment_num=0; segment_num<segments_count; segment_num++){
@@ -649,6 +650,7 @@ void Tdistfile::inc_dld_segments_count(Tsegment* current_segment){
stats.inc_dld_size(current_segment->segment_size);
if (++dld_segments_count==segments_count)
combine_segments();
+ stats.dld_segments_count++;
}catch(...){
error_log("Error: distfile.cpp: inc_dld_segments_count()");
}
diff --git a/segget/stats.cpp b/segget/stats.cpp
index 0dbc4c1..a49b589 100644
--- a/segget/stats.cpp
+++ b/segget/stats.cpp
@@ -69,6 +69,8 @@ void Tstats::show_totals(){
// +field(" = DFs:", dld_distfiles_count,4)
+" = DF:"+toString(dld_distfiles_count)
+field("/", distfiles_count,4)
+ +" = Sg:"+toString(dld_segments_count)
+ +field("/", segments_count,5)
// +field(" = Size:", dld_size/1000,7)
+" = Size:"+toString(dld_size/1000)
+field("(", ((double)dld_size/show_total_size)*100,3)+"%)"
diff --git a/segget/stats.h b/segget/stats.h
index 6402cc8..99f2ffa 100644
--- a/segget/stats.h
+++ b/segget/stats.h
@@ -44,7 +44,9 @@ class Tstats{
double last_time_interval;
ulong avg_total_speed;
uint pkg_count;
- uint distfiles_count;
+ ulong distfiles_count;
+ ulong segments_count;
+ ulong dld_segments_count;
ulong active_connections_counter;
Tstats():
dld_size(0),
@@ -56,6 +58,8 @@ class Tstats{
avg_total_speed(0),
pkg_count(0),
distfiles_count(0),
+ segments_count(0),
+ dld_segments_count(0),
active_connections_counter(0)
{};
void inc_dld_size(ulong more_bytes){ dld_size+=more_bytes;};