version 1.55, 1997/12/16 21:09:49
|
version 1.56, 1997/12/22 14:46:35
|
Line 81 typedef struct _Robot {
|
Line 81 typedef struct _Robot {
|
|
|
long total_bytes; /* Total number of bytes processed */ |
long total_bytes; /* Total number of bytes processed */ |
long total_docs; /* Total number of documents processed */ |
long total_docs; /* Total number of documents processed */ |
time_t time; /* Time of run */ |
ms_t time; /* Time of run */ |
} Robot; |
} Robot; |
|
|
typedef struct _Finger { |
typedef struct _Finger { |
Line 226 PRIVATE BOOL calculate_statistics (Robot
|
Line 226 PRIVATE BOOL calculate_statistics (Robot
|
|
|
/* Calculate efficiency */ |
/* Calculate efficiency */ |
{ |
{ |
time_t t = time(NULL) - mr->time; |
ms_t t = HTGetTimeInMillis() - mr->time; |
if (t > 0.0) { |
if (t > 0) { |
double loadfactor = mr->total_bytes / t; |
double loadfactor = 1000 * (mr->total_bytes / t); |
|
double secs = t / 1000.0; |
char bytes[50]; |
char bytes[50]; |
HTNumToStr(mr->total_bytes, bytes, 50); |
HTNumToStr(mr->total_bytes, bytes, 50); |
HTTrace("Downloaded %s bytes in %ld document bodies in %ld seconds (%2.1f bytes/sec)\n", |
HTTrace("Downloaded %s bytes in %ld document bodies in %.2f seconds (%2.1f bytes/sec)\n", |
bytes, mr->total_docs, t, loadfactor); |
bytes, mr->total_docs, secs, loadfactor); |
} |
} |
} |
} |
|
|
Line 432 PRIVATE int terminate_handler (HTRequest
|
Line 433 PRIVATE int terminate_handler (HTRequest
|
|
|
/* Count the amount of body data that we have read */ |
/* Count the amount of body data that we have read */ |
if (status == HT_LOADED && HTRequest_method(request) == METHOD_GET) { |
if (status == HT_LOADED && HTRequest_method(request) == METHOD_GET) { |
mr->total_bytes += HTAnchor_length(HTRequest_anchor(request)); |
int length = HTAnchor_length(HTRequest_anchor(request)); |
|
if (length > 0) mr->total_bytes += length; |
} |
} |
|
|
/* Count the number of documents that we have processed */ |
/* Count the number of documents that we have processed */ |
Line 743 int main (int argc, char ** argv)
|
Line 745 int main (int argc, char ** argv)
|
} else { /* If no leading `-' then check for URL or keywords */ |
} else { /* If no leading `-' then check for URL or keywords */ |
if (!keycnt) { |
if (!keycnt) { |
char * ref = HTParse(argv[arg], mr->cwd, PARSE_ALL); |
char * ref = HTParse(argv[arg], mr->cwd, PARSE_ALL); |
startAnchor = (HTParentAnchor *) HTAnchor_findAddress(ref); |
startAnchor = HTAnchor_parent(HTAnchor_findAddress(ref)); |
HyperDoc_new(mr, startAnchor, 0); |
HyperDoc_new(mr, startAnchor, 0); |
keycnt = 1; |
keycnt = 1; |
HT_FREE(ref); |
HT_FREE(ref); |
Line 810 int main (int argc, char ** argv)
|
Line 812 int main (int argc, char ** argv)
|
/* Setting event timeout */ |
/* Setting event timeout */ |
HTHost_setEventTimeout(mr->timer); |
HTHost_setEventTimeout(mr->timer); |
|
|
mr->time = time(NULL); |
mr->time = HTGetTimeInMillis(); |
|
|
/* Start the request */ |
/* Start the request */ |
finger = Finger_new(mr, startAnchor, METHOD_GET); |
finger = Finger_new(mr, startAnchor, METHOD_GET); |