checkin notes, transfer speed fix

svn path=/trunk/boinc/; revision=976
This commit is contained in:
Eric Heien 2003-02-26 07:45:21 +00:00
parent ff543a3c12
commit e24b2709a8
3 changed files with 38 additions and 5 deletions

View File

@ -3467,3 +3467,32 @@ David Feb 25 2003
test/
test.inc
test_uc.php
Eric Feb 25, 2003
- Added net transfer progress. Tracks number of bytes transferred
for file uploads and downloads.
- Fixed Windows battery status bug.
- Net transfer speed measurement in bytes/sec. The measurement decays by
1/2 every 3 seconds.
- Added PHP function to password protect project admin pages via .htaccess.
- Altered show_message function to specify the project a message is
associated with.
client/
client_state.C
cs_scheduler.C
file_xfer.C
net_xfer.C,h
pers_file_xfer.C
mac/
mac_main.cpp
main.C
message.h
scheduler_op.C
win/
wingui_mainwindow.cpp
wingui.cpp
hostinfo_win.cpp
test/
test.inc

View File

@ -173,6 +173,7 @@ void NET_XFER::init(char* host, int p, int b) {
port = p;
blocksize = b;
xfer_speed = 0;
recent_bytes = 0;
last_speed_update = 0;
}
@ -455,19 +456,22 @@ int NET_XFER::do_xfer(int& nbytes_transferred) {
}
// Update the transfer speed for this NET_XFER
// Decay speed by 1/e every second
// Decay speed by 1/2 every 3 seconds
//
void NET_XFER::update_speed(int nbytes) {
time_t now, delta_t;
double x;
now = time(0);
recent_bytes += nbytes;
if (last_speed_update==0) last_speed_update = now;
delta_t = now-last_speed_update;
if (delta_t<=0) delta_t = 0;
x = exp(-(double)delta_t/(double)CLOCKS_PER_SEC);
xfer_speed = (x*xfer_speed)+nbytes;
if (delta_t<=0) return;
x = exp(-delta_t*log(2)/3.0);
xfer_speed *= x;
xfer_speed += recent_bytes*(1-x);
last_speed_update = now;
recent_bytes = 0;
}
void NET_XFER::got_error() {

View File

@ -52,7 +52,7 @@ public:
char hostname[256];
int port;
int blocksize;
double xfer_speed; // in bytes per second
double xfer_speed,recent_bytes; // in bytes per second
clock_t last_speed_update;
double bytes_xferred;