File transfer times now in mSecs calculated

This commit is contained in:
Michiel Broek 2002-04-04 20:58:04 +00:00
parent c00a90da19
commit 56ea18bebf
8 changed files with 59 additions and 73 deletions

View File

@ -4738,7 +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. All filetransfer times and cps rates are calculated in mSecs.
mbout: mbout:
The status display has now 9 digits for the outbound size. The status display has now 9 digits for the outbound size.

View File

@ -88,11 +88,11 @@ depend:
# Dependencies generated by make depend # Dependencies generated by make depend
zmmisc.o: ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ttyio.h session.h zmodem.h zmmisc.o: ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ttyio.h session.h zmodem.h
zmrle.o: ../lib/libs.h ../lib/structs.h ../lib/clcomm.h ../lib/common.h ttyio.h session.h zmodem.h zmrle.o: ../lib/libs.h ../lib/structs.h ../lib/clcomm.h ../lib/common.h ttyio.h session.h zmodem.h
zmrecv.o: ../lib/libs.h ../lib/structs.h ../lib/clcomm.h ../lib/common.h lutil.h ttyio.h session.h zmodem.h config.h emsi.h openfile.h openport.h zmrecv.o: ../lib/libs.h ../lib/structs.h ../lib/clcomm.h ../lib/common.h lutil.h ttyio.h session.h zmodem.h config.h emsi.h openfile.h filelist.h openport.h
zmsend.o: ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ttyio.h session.h zmodem.h lutil.h emsi.h filelist.h zmsend.o: ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ttyio.h session.h zmodem.h lutil.h emsi.h filelist.h
binkp.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/dbnode.h ../lib/clcomm.h ttyio.h session.h statetbl.h config.h emsi.h openfile.h respfreq.h filelist.h opentcp.h rdoptions.h lutil.h binkp.h config.h binkp.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/dbnode.h ../lib/clcomm.h ttyio.h session.h statetbl.h config.h emsi.h openfile.h respfreq.h filelist.h opentcp.h rdoptions.h lutil.h binkp.h config.h
xmsend.o: ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h session.h ttyio.h statetbl.h xmsend.h m7send.h filelist.h filetime.h xmsend.o: ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h session.h ttyio.h statetbl.h xmsend.h m7send.h filelist.h filetime.h
xmrecv.o: ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h session.h ttyio.h statetbl.h config.h lutil.h openfile.h m7recv.h xmrecv.h filetime.h xmrecv.o: ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h session.h ttyio.h statetbl.h config.h lutil.h openfile.h m7recv.h xmrecv.h filelist.h filetime.h
m7recv.o: ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h statetbl.h ttyio.h m7recv.h m7recv.o: ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h statetbl.h ttyio.h m7recv.h
m7send.o: ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h statetbl.h ttyio.h m7send.h m7send.o: ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h statetbl.h ttyio.h m7send.h
hydra.o: ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h session.h filelist.h filetime.h ttyio.h statetbl.h config.h emsi.h openfile.h lutil.h respfreq.h mbcico.h hydra.h hydra.o: ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h session.h filelist.h filetime.h ttyio.h statetbl.h config.h emsi.h openfile.h lutil.h respfreq.h mbcico.h hydra.h

View File

@ -32,9 +32,6 @@
/* /*
* ifcico v3.0.cm - hydra protocol module * ifcico v3.0.cm - hydra protocol module
* Copyright (C) 1996-98 Christof Meerwald. * Copyright (C) 1996-98 Christof Meerwald.
*
* $RCSfile$ - $Author$
* $Revision$ - $Date$
*/ */
/* /*
@ -546,8 +543,9 @@ int hydra_batch(int role, file_list *to_send)
int txwaitpkt, rxwaitpkt; int txwaitpkt, rxwaitpkt;
enum HyPktTypes pkttype; enum HyPktTypes pkttype;
int waitputget = 0; int waitputget = 0;
time_t rxstarttime, rxendtime; struct timeval txstarttime, txendtime;
time_t txstarttime, txendtime; struct timeval rxstarttime, rxendtime;
struct timezone tz;
int sverr; int sverr;
Syslog('h', "Hydra: resettimers"); Syslog('h', "Hydra: resettimers");
@ -566,8 +564,9 @@ int hydra_batch(int role, file_list *to_send)
SETTIMER(TIMERNO_BRAIN, H_BRAINDEAD); SETTIMER(TIMERNO_BRAIN, H_BRAINDEAD);
txstate = HTX_START; txstate = HTX_START;
txoptions = HTXI_OPTIONS; txoptions = HTXI_OPTIONS;
rxstarttime = txstarttime = time(NULL); txstarttime.tv_sec = txstarttime.tv_usec = txendtime.tv_sec = txendtime.tv_usec = 0;
rxstarttime.tv_sec = rxstarttime.tv_usec = rxendtime.tv_sec = rxendtime.tv_usec = 0;
tz.tz_minuteswest = tz.tz_dsttime = 0;
rxstate = HRX_INIT; rxstate = HRX_INIT;
rxoptions = HRXI_OPTIONS; rxoptions = HRXI_OPTIONS;
@ -839,7 +838,7 @@ int hydra_batch(int role, file_list *to_send)
Syslog('+', "Hydra: send \"%s\" as \"%s\"", MBSE_SS(to_send->local), MBSE_SS(to_send->remote)); Syslog('+', "Hydra: send \"%s\" as \"%s\"", MBSE_SS(to_send->local), MBSE_SS(to_send->remote));
Syslog('+', "Hydra: size %lu bytes, dated %s",(unsigned long)txstat.st_size, date(txstat.st_mtime)); Syslog('+', "Hydra: size %lu bytes, dated %s",(unsigned long)txstat.st_size, date(txstat.st_mtime));
txstarttime = time(NULL); gettimeofday(&txstarttime, &tz);
} }
txstate = HTX_ToFName; txstate = HTX_ToFName;
@ -1116,22 +1115,18 @@ int hydra_batch(int role, file_list *to_send)
/* /*
* calculate time needed and bytes transferred * calculate time needed and bytes transferred
*/ */
txendtime = time(NULL); gettimeofday(&txendtime, &tz);
txstarttime = txendtime - txstarttime;
if (txstarttime <= 0L)
txstarttime = 1L;
/* close transmitter file */ /* close transmitter file */
fclose(txfp); fclose(txfp);
if (txpos >= 0) { if (txpos >= 0) {
stxpos = txpos - stxpos; stxpos = txpos - stxpos;
Syslog('+', "Hydra: OK %lu bytes in %s (%ld cps)", Syslog('+', "Hydra: OK %s", transfertime(txstarttime, txendtime, stxpos, TRUE));
stxpos, str_time(txstarttime), stxpos/txstarttime);
execute_disposition(to_send); execute_disposition(to_send);
} else { } else {
Syslog('+', "Hydra: transmitter skipped file after %ld seconds", txstarttime); Syslog('+', "Hydra: transmitter skipped file after %ld seconds",
txendtime.tv_sec - txstarttime.tv_sec);
} }
to_send = to_send->next; to_send = to_send->next;
@ -1325,7 +1320,7 @@ int hydra_batch(int role, file_list *to_send)
Name, filesize, date(timestamp)); Name, filesize, date(timestamp));
rxfp = openfile(Name, timestamp, filesize, &rxpos, resync); rxfp = openfile(Name, timestamp, filesize, &rxpos, resync);
rxstarttime = time(NULL); gettimeofday(&rxstarttime, &tz);
/* check for error opening file */ /* check for error opening file */
if (rxfp) { if (rxfp) {
@ -1415,19 +1410,15 @@ int hydra_batch(int role, file_list *to_send)
/* /*
* calculate time and CPU usage needed * calculate time and CPU usage needed
*/ */
rxendtime = time(NULL); gettimeofday(&rxendtime, &tz);
if (rxpos >= 0) { if (rxpos >= 0) {
rxfp = NULL; rxfp = NULL;
if (!closefile(1)) { if (!closefile(1)) {
srxpos = rxpos - srxpos; srxpos = rxpos - srxpos;
rxstarttime = rxendtime - rxstarttime; Syslog('+', "Hydra: OK %s",
if (rxstarttime <= 0) transfertime(rxstarttime, rxendtime, srxpos, FALSE));
rxstarttime = 1L;
Syslog('+', "Hydra: OK %lu bytes in %s (%ld cps)",
srxpos, str_time(rxstarttime), srxpos/rxstarttime);
rxstate = HRX_OkEOF; rxstate = HRX_OkEOF;
} else { } else {
@ -1442,7 +1433,7 @@ int hydra_batch(int role, file_list *to_send)
} }
} else { } else {
Syslog('+', "Hydra: receiver skipped file after %ld seconds", Syslog('+', "Hydra: receiver skipped file after %ld seconds",
rxendtime - rxstarttime); rxendtime.tv_sec - rxstarttime.tv_sec);
if (rxfp) { if (rxfp) {
closefile(0); closefile(0);

View File

@ -54,7 +54,9 @@ static FILE *in;
static char txbuf[2048]; static char txbuf[2048];
static char rxbuf[2048]; static char rxbuf[2048];
static int rx_type; static int rx_type;
static long startime,endtime,sbytes; static long sbytes;
struct timeval starttime, endtime;
struct timezone tz;
static off_t rxbytes; static off_t rxbytes;
static int sendtfile(char *,char *); static int sendtfile(char *,char *);
@ -197,7 +199,7 @@ static int sendtfile(char *ln, char *rn)
if (st.st_size > 0) { if (st.st_size > 0) {
Syslog('+', "TCP send \"%s\" as \"%s\"", MBSE_SS(ln), MBSE_SS(rn)); Syslog('+', "TCP send \"%s\" as \"%s\"", MBSE_SS(ln), MBSE_SS(rn));
Syslog('+', "TCP size %lu bytes, dated %s", (unsigned long)st.st_size, date(st.st_mtime)); Syslog('+', "TCP size %lu bytes, dated %s", (unsigned long)st.st_size, date(st.st_mtime));
startime = time(NULL); gettimeofday(&starttime, &tz);
} else { } else {
Syslog('+', "File \"%s\" has 0 size, skiped",ln); Syslog('+', "File \"%s\" has 0 size, skiped",ln);
return 0; return 0;
@ -239,15 +241,9 @@ static int sendtfile(char *ln, char *rn)
} }
if (rc == 0 && strncmp(rxbuf,"FOK",3) == 0) { if (rc == 0 && strncmp(rxbuf,"FOK",3) == 0) {
endtime = time(NULL); gettimeofday(&endtime, &tz);
if ((startime=endtime-startime) == 0)
startime = 1;
Syslog('a', "st_size %d, offset %d",st.st_size,offset); Syslog('a', "st_size %d, offset %d",st.st_size,offset);
Syslog('+', "Sent %lu bytes in %s (%ld cps)", Syslog('+', "TCP: OK %s", transfertime(starttime, endtime, st.st_size-offset, TRUE));
(unsigned long)st.st_size-offset,
str_time(startime),
(long)(st.st_size-offset)/startime);
sentbytes += (unsigned long)st.st_size - offset; sentbytes += (unsigned long)st.st_size - offset;
return 0; return 0;
} else if(strncmp(rxbuf,"FERROR",6) == 0){ } else if(strncmp(rxbuf,"FERROR",6) == 0){
@ -274,13 +270,12 @@ static int closeit(int success)
rc = closefile(success); rc = closefile(success);
fout = NULL; fout = NULL;
sbytes = rxbytes - sbytes; sbytes = rxbytes - sbytes;
endtime = time(NULL); gettimeofday(&endtime, &tz);
if ((startime = endtime - startime) == 0L) if (success)
startime = 1L; Syslog('+', "TCP: OK %s", transfertime(starttime, endtime, sbytes, FALSE));
Syslog('+', "%s %lu bytes in %s (%ld cps)", else
success?"OK":"dropped after", Syslog('+', "TCP: dropped after %ld bytes", sbytes);
sbytes, str_time(startime), sbytes / startime);
rcvdbytes += sbytes; rcvdbytes += sbytes;
return rc; return rc;
} }
@ -311,7 +306,7 @@ static int receivefile(char *fn, time_t ft, off_t fs)
Syslog('+', "TCP receive \"%s\" (%lu bytes) dated %s",fn,fs,date(ft)); Syslog('+', "TCP receive \"%s\" (%lu bytes) dated %s",fn,fs,date(ft));
strcpy(txbuf,"ROK"); strcpy(txbuf,"ROK");
fout = openfile(fn, ft, fs, &rxbytes, resync); fout = openfile(fn, ft, fs, &rxbytes, resync);
startime = time(NULL); gettimeofday(&starttime, &tz);
sbytes = rxbytes; sbytes = rxbytes;
if (fs == rxbytes) { if (fs == rxbytes) {

View File

@ -40,6 +40,7 @@
#include "openfile.h" #include "openfile.h"
#include "m7recv.h" #include "m7recv.h"
#include "xmrecv.h" #include "xmrecv.h"
#include "filelist.h"
#include "filetime.h" #include "filetime.h"
@ -54,7 +55,8 @@ static char *recvname=NULL;
static char *fpath=NULL; static char *fpath=NULL;
static FILE *fp=NULL; static FILE *fp=NULL;
static int last; static int last;
static time_t stm,etm; struct timeval starttime, endtime;
struct timezone tz;
static off_t startofs; static off_t startofs;
static long recv_blk; static long recv_blk;
@ -88,11 +90,11 @@ int closeit(int success)
off_t endofs; off_t endofs;
endofs = recv_blk*XMBLKSIZ; endofs = recv_blk*XMBLKSIZ;
etm = time(NULL); gettimeofday(&endtime, &tz);
if (etm == stm) if (success)
etm++; Syslog('+', "Xmodem: OK %s", transfertime(starttime, endtime, endofs-startofs, FALSE));
Syslog('+', "Xmodem %s %lu bytes in %s (%lu cps)", success?"received":"dropped after", else
(unsigned long)(endofs-startofs),str_time(etm-stm), (unsigned long)(endofs-startofs)/(etm-stm)); Syslog('+', "Xmodem: dropped after %ld bytes", endofs-startofs);
rcvdbytes += (unsigned long)(endofs-startofs); rcvdbytes += (unsigned long)(endofs-startofs);
fp = NULL; fp = NULL;
return closefile(success); return closefile(success);
@ -146,7 +148,7 @@ SM_EDECL
int goteot = FALSE; int goteot = FALSE;
Syslog('x', "xmrecv INIT"); Syslog('x', "xmrecv INIT");
stm = time(NULL); gettimeofday(&starttime, &tz);
recv_blk=-1L; recv_blk=-1L;
memset(&tmpfname, 0, sizeof(tmpfname)); memset(&tmpfname, 0, sizeof(tmpfname));

View File

@ -97,7 +97,8 @@ SM_EDECL
int a,a1,a2; int a,a1,a2;
int i; int i;
time_t seatime; time_t seatime;
time_t stm,etm; struct timeval starttime, endtime;
struct timezone tz;
unsigned char header=SOH; unsigned char header=SOH;
struct _xmblk { struct _xmblk {
unsigned char n1; unsigned char n1;
@ -122,7 +123,7 @@ SM_EDECL
fl.l_len=0L; fl.l_len=0L;
Syslog('x', "xmsend INIT"); Syslog('x', "xmsend INIT");
stm = time(NULL); gettimeofday(&starttime, &tz);
/* if we got 'C' than hopefully remote is sealink capable... */ /* if we got 'C' than hopefully remote is sealink capable... */
@ -235,11 +236,8 @@ SM_STATE(sendblk)
} else if (ackd_blk < last_blk) { } else if (ackd_blk < last_blk) {
SM_PROCEED(waitack); SM_PROCEED(waitack);
} else { } else {
etm = time(NULL); gettimeofday(&endtime, &tz);
if (etm == stm) Syslog('+', "Xmodem: OK %s", transfertime(starttime, endtime, st.st_size, TRUE));
etm++;
Syslog('+', "sent %lu bytes in %s (%lu cps)", (unsigned long)st.st_size,str_time(etm-stm),
(unsigned long)st.st_size/(etm-stm));
sentbytes += (unsigned long)st.st_size; sentbytes += (unsigned long)st.st_size;
fclose(fp); fclose(fp);
SM_SUCCESS; SM_SUCCESS;

View File

@ -39,6 +39,7 @@
#include "config.h" #include "config.h"
#include "emsi.h" #include "emsi.h"
#include "openfile.h" #include "openfile.h"
#include "filelist.h"
#include "openport.h" #include "openport.h"
@ -52,8 +53,9 @@ static int Usevhdrs;
static long rxbytes; static long rxbytes;
static int Eofseen; /* indicates cpm eof (^Z) has been received */ static int Eofseen; /* indicates cpm eof (^Z) has been received */
static int errors; static int errors;
static time_t startime,etime;
static long sbytes; static long sbytes;
struct timeval starttime, endtime;
struct timezone tz;
#define DEFBYTL 2000000000L /* default rx file size */ #define DEFBYTL 2000000000L /* default rx file size */
static long Bytesleft; /* number of bytes of incoming file left */ static long Bytesleft; /* number of bytes of incoming file left */
@ -441,11 +443,11 @@ int closeit(int success)
rc = closefile(success); rc = closefile(success);
fout = NULL; fout = NULL;
sbytes = rxbytes - sbytes; sbytes = rxbytes - sbytes;
etime = time(NULL); gettimeofday(&endtime, &tz);
if ((startime = etime - startime) == 0L) if (success)
startime = 1L; Syslog('+', "Zmodem: OK %s", transfertime(starttime, endtime, sbytes, FALSE));
Syslog('+', "Zmodem: %s %lu bytes in %s (%ld cps)", success?"OK":"dropped after", else
sbytes, str_time(startime), sbytes / startime); Syslog('+', "Zmodem: dropped after %lu bytes", sbytes);
rcvdbytes += sbytes; rcvdbytes += sbytes;
return rc; return rc;
} }
@ -514,7 +516,7 @@ int procheader(char *Name)
Syslog('+', "Zmodem: \"%s\" %ld bytes, %s mode %o", Name, Bytesleft, ctt, Filemode); Syslog('+', "Zmodem: \"%s\" %ld bytes, %s mode %o", Name, Bytesleft, ctt, Filemode);
fout = openfile(Name,Modtime,Bytesleft,&(long)(rxbytes),resync); fout = openfile(Name,Modtime,Bytesleft,&(long)(rxbytes),resync);
startime = time(NULL); gettimeofday(&starttime, &tz);
sbytes = rxbytes; sbytes = rxbytes;
if (Bytesleft == rxbytes) { if (Bytesleft == rxbytes) {

View File

@ -73,8 +73,9 @@ static int Lskipnocor=0;
static int Lzconv=0; static int Lzconv=0;
static int Beenhereb4; static int Beenhereb4;
static char Myattn[]={0}; static char Myattn[]={0};
static long startime,endtime;
static long skipsize; static long skipsize;
struct timeval starttime, endtime;
struct timezone tz;
extern unsigned long sentbytes; extern unsigned long sentbytes;
extern int Rxhlen; extern int Rxhlen;
@ -211,7 +212,7 @@ static int sendzfile(char *ln, char *rn)
Syslog('+', "Zmodem: send \"%s\" as \"%s\"", MBSE_SS(ln), MBSE_SS(rn)); Syslog('+', "Zmodem: send \"%s\" as \"%s\"", MBSE_SS(ln), MBSE_SS(rn));
Syslog('+', "Zmodem: size %lu bytes, dated %s", (unsigned long)st.st_size, date(st.st_mtime)); Syslog('+', "Zmodem: size %lu bytes, dated %s", (unsigned long)st.st_size, date(st.st_mtime));
startime = time(NULL); gettimeofday(&starttime, &tz);
sprintf(txbuf,"%s %lu %lo %o 0 0 0", rn,(unsigned long)st.st_size, st.st_mtime+(st.st_mtime%2), st.st_mode); sprintf(txbuf,"%s %lu %lo %o 0 0 0", rn,(unsigned long)st.st_size, st.st_mtime+(st.st_mtime%2), st.st_mode);
bufl = strlen(txbuf); bufl = strlen(txbuf);
@ -223,11 +224,8 @@ static int sendzfile(char *ln, char *rn)
Syslog('+', "Zmodem: remote skipped %s, is OK",MBSE_SS(ln)); Syslog('+', "Zmodem: remote skipped %s, is OK",MBSE_SS(ln));
return 0; return 0;
} else if ((rc == OK) && (st.st_size - skipsize)) { } else if ((rc == OK) && (st.st_size - skipsize)) {
endtime = time(NULL); gettimeofday(&endtime, &tz);
if ((startime = endtime - startime) == 0) Syslog('+', "Zmodem: OK %s", transfertime(starttime, endtime, (unsigned long)st.st_size - skipsize, TRUE));
startime = 1;
Syslog('+', "Zmodem: OK %lu bytes in %s (%ld cps)", (unsigned long)st.st_size - skipsize, str_time(startime),
(long)(st.st_size-skipsize) / startime);
sentbytes += (unsigned long)st.st_size - skipsize; sentbytes += (unsigned long)st.st_size - skipsize;
return 0; return 0;
} else } else