Binkp transfer times in mSecs. (experimental)
This commit is contained in:
parent
2c0813c3b9
commit
c00a90da19
@ -4738,6 +4738,7 @@ v0.33.20 10-Feb-2002
|
|||||||
Added experimental support for binkp GET command frame, under
|
Added experimental support for binkp GET command frame, under
|
||||||
test now.
|
test now.
|
||||||
Registers TCP/IP sessions with mbtask.
|
Registers TCP/IP sessions with mbtask.
|
||||||
|
Experimental: binkp filetransfer times are calculated in mSec.
|
||||||
|
|
||||||
mbout:
|
mbout:
|
||||||
The status display has now 9 digits for the outbound size.
|
The status display has now 9 digits for the outbound size.
|
||||||
|
@ -811,8 +811,6 @@ int binkp_batch(file_list *to_send)
|
|||||||
int rxlen = 0, txlen = 0;
|
int rxlen = 0, txlen = 0;
|
||||||
long txpos = 0, rxpos = 0;
|
long txpos = 0, rxpos = 0;
|
||||||
long stxpos = 0;
|
long stxpos = 0;
|
||||||
time_t rxstarttime, rxendtime;
|
|
||||||
time_t txstarttime, txendtime;
|
|
||||||
int sverr, cmd = FALSE, GotFrame = FALSE;
|
int sverr, cmd = FALSE, GotFrame = FALSE;
|
||||||
int blklen = 0, c, Found = FALSE;
|
int blklen = 0, c, Found = FALSE;
|
||||||
unsigned short header = 0;
|
unsigned short header = 0;
|
||||||
@ -823,6 +821,15 @@ int binkp_batch(file_list *to_send)
|
|||||||
long written;
|
long written;
|
||||||
binkp_list *bll = NULL, *tmp, *tmpg, *cursend = NULL;
|
binkp_list *bll = NULL, *tmp, *tmpg, *cursend = NULL;
|
||||||
file_list *tsl;
|
file_list *tsl;
|
||||||
|
struct timeval rxtvstart, rxtvend;
|
||||||
|
struct timeval txtvstart, txtvend;
|
||||||
|
struct timezone tz;
|
||||||
|
|
||||||
|
rxtvstart.tv_sec = rxtvstart.tv_usec = 0;
|
||||||
|
rxtvend.tv_sec = rxtvend.tv_usec = 0;
|
||||||
|
txtvstart.tv_sec = txtvstart.tv_usec = 0;
|
||||||
|
txtvend.tv_sec = txtvend.tv_usec = 0;
|
||||||
|
tz.tz_minuteswest = tz.tz_dsttime = 0;
|
||||||
|
|
||||||
batchnr++;
|
batchnr++;
|
||||||
Syslog('+', "Binkp: starting batch %d", batchnr);
|
Syslog('+', "Binkp: starting batch %d", batchnr);
|
||||||
@ -837,7 +844,6 @@ int binkp_batch(file_list *to_send)
|
|||||||
binkp_settimer(BINKP_TIMEOUT);
|
binkp_settimer(BINKP_TIMEOUT);
|
||||||
nethold = mailhold = 0L;
|
nethold = mailhold = 0L;
|
||||||
transferred = FALSE;
|
transferred = FALSE;
|
||||||
rxstarttime = txstarttime = time(NULL);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Build a new filelist from the existing filelist.
|
* Build a new filelist from the existing filelist.
|
||||||
@ -950,7 +956,7 @@ int binkp_batch(file_list *to_send)
|
|||||||
Syslog('+', "Binkp: size %lu bytes, dated %s", (unsigned long)tmp->size, date(tmp->date));
|
Syslog('+', "Binkp: size %lu bytes, dated %s", (unsigned long)tmp->size, date(tmp->date));
|
||||||
binkp_send_control(MM_FILE, "%s %lu %ld %ld", MBSE_SS(tmp->remote),
|
binkp_send_control(MM_FILE, "%s %lu %ld %ld", MBSE_SS(tmp->remote),
|
||||||
(unsigned long)tmp->size, (long)tmp->date, (unsigned long)tmp->offset);
|
(unsigned long)tmp->size, (long)tmp->date, (unsigned long)tmp->offset);
|
||||||
txstarttime = time(NULL);
|
gettimeofday(&txtvstart, &tz);
|
||||||
tmp->state = Sending;
|
tmp->state = Sending;
|
||||||
cursend = tmp;
|
cursend = tmp;
|
||||||
TxState = TxTryRead;
|
TxState = TxTryRead;
|
||||||
@ -998,10 +1004,7 @@ int binkp_batch(file_list *to_send)
|
|||||||
/*
|
/*
|
||||||
* calculate time needed and bytes transferred
|
* calculate time needed and bytes transferred
|
||||||
*/
|
*/
|
||||||
txendtime = time(NULL);
|
gettimeofday(&txtvend, &tz);
|
||||||
txstarttime = txendtime - txstarttime;
|
|
||||||
if (txstarttime <= 0L)
|
|
||||||
txstarttime = 1L;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Close transmitter file
|
* Close transmitter file
|
||||||
@ -1010,10 +1013,10 @@ int binkp_batch(file_list *to_send)
|
|||||||
|
|
||||||
if (txpos >= 0) {
|
if (txpos >= 0) {
|
||||||
stxpos = txpos - stxpos;
|
stxpos = txpos - stxpos;
|
||||||
Syslog('+', "Binkp: OK %lu bytes send in %s (%ld cps)",
|
Syslog('+', "Binkp: OK %s", transfertime(txtvstart, txtvend, stxpos, TRUE));
|
||||||
stxpos, str_time(txstarttime), stxpos/txstarttime);
|
|
||||||
} else {
|
} else {
|
||||||
Syslog('+', "Binkp: transmitter skipped file after %ld seconds", txstarttime);
|
Syslog('+', "Binkp: transmitter skipped file after %ld seconds",
|
||||||
|
txtvend.tv_sec - txtvstart.tv_sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
cursend->state = IsSent;
|
cursend->state = IsSent;
|
||||||
@ -1124,11 +1127,8 @@ int binkp_batch(file_list *to_send)
|
|||||||
binkp_send_control(MM_GOT, "%s %ld %ld", rname, rsize, rtime);
|
binkp_send_control(MM_GOT, "%s %ld %ld", rname, rsize, rtime);
|
||||||
closefile(TRUE);
|
closefile(TRUE);
|
||||||
rxpos = rxpos - rxbytes;
|
rxpos = rxpos - rxbytes;
|
||||||
rxendtime = time(NULL);
|
gettimeofday(&rxtvend, &tz);
|
||||||
if ((rxstarttime = rxendtime - rxstarttime) == 0L)
|
Syslog('+', "Binkp: OK %s", transfertime(rxtvstart, rxtvend, rxpos, FALSE));
|
||||||
rxstarttime = 1L;
|
|
||||||
Syslog('+', "Binkp: received OK %lu bytes in %s (%ld cps)",
|
|
||||||
rxpos, str_time(rxstarttime), rxpos / rxstarttime);
|
|
||||||
rcvdbytes += rxpos;
|
rcvdbytes += rxpos;
|
||||||
RxState = RxWaitFile;
|
RxState = RxWaitFile;
|
||||||
transferred = TRUE;
|
transferred = TRUE;
|
||||||
@ -1151,7 +1151,7 @@ int binkp_batch(file_list *to_send)
|
|||||||
case RxAcceptFile:
|
case RxAcceptFile:
|
||||||
Syslog('+', "Binkp: receive file \"%s\" date %s size %ld offset %ld", rname, date(rtime), rsize, roffs);
|
Syslog('+', "Binkp: receive file \"%s\" date %s size %ld offset %ld", rname, date(rtime), rsize, roffs);
|
||||||
rxfp = openfile(rname, rtime, rsize, &rxbytes, resync);
|
rxfp = openfile(rname, rtime, rsize, &rxbytes, resync);
|
||||||
rxstarttime = time(NULL);
|
gettimeofday(&rxtvstart, &tz);
|
||||||
rxpos = 0;
|
rxpos = 0;
|
||||||
|
|
||||||
if (!diskfree(CFG.freespace)) {
|
if (!diskfree(CFG.freespace)) {
|
||||||
|
@ -474,3 +474,21 @@ void execute_disposition(file_list *fl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
char *transfertime(struct timeval start, struct timeval end, long bytes, int sent)
|
||||||
|
{
|
||||||
|
static char resp[81];
|
||||||
|
long startms, endms, elapsed;
|
||||||
|
|
||||||
|
memset(&resp, 0, sizeof(resp));
|
||||||
|
startms = (start.tv_sec * 1000) + (start.tv_usec / 1000);
|
||||||
|
endms = (end.tv_sec * 1000) + (end.tv_usec / 1000);
|
||||||
|
elapsed = endms - startms;
|
||||||
|
if (!elapsed)
|
||||||
|
elapsed = 1L;
|
||||||
|
sprintf(resp, "%ld bytes %s in %0.3f seconds (%ld cps)",
|
||||||
|
bytes, sent?"sent":"received", elapsed / 1000.000, (bytes * 1000) / elapsed);
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
/* $Id$ */
|
||||||
|
|
||||||
#ifndef _FILELIST_H
|
#ifndef _FILELIST_H
|
||||||
#define _FILELIST_H
|
#define _FILELIST_H
|
||||||
|
|
||||||
@ -7,6 +9,7 @@ file_list *create_filelist(fa_list *, char *, int);
|
|||||||
file_list *create_freqlist(fa_list *);
|
file_list *create_freqlist(fa_list *);
|
||||||
void tidy_filelist(file_list *, int);
|
void tidy_filelist(file_list *, int);
|
||||||
void execute_disposition(file_list *);
|
void execute_disposition(file_list *);
|
||||||
|
char *transfertime(struct timeval, struct timeval, long, int);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user