log execution times for two cgi scripts (scheduler and

file_upload_handler)

better print format for timezone

svn path=/trunk/boinc/; revision=6023
This commit is contained in:
Bruce Allen 2005-05-04 16:31:25 +00:00
parent 0013bce230
commit 835c2090f5
7 changed files with 41 additions and 7 deletions

View File

@ -6021,3 +6021,16 @@ Janus 4 May 2005
forum.inc
db_forum.inc (new)
Bruce 4 May 2005
- log execution times for two cgi scripts (scheduler and
file_upload_handler)
- better print format for timezone
sched/
sched_util.h
sched_util.C
sched_timezone.C
main.C
sched_send.C
file_upload_handler.C

View File

@ -466,6 +466,8 @@ int handle_request(FILE* in, R_RSA_PUBLIC_KEY& key) {
return return_error(ERR_PERMANENT, "no command");
}
log_messages.printf(SCHED_MSG_LOG::DEBUG, "run time %d seconds\n", elapsed_time());
return retval;
}
@ -484,9 +486,9 @@ int get_key(R_RSA_PUBLIC_KEY& key) {
void boinc_catch_signal(int signal_num) {
log_messages.printf(SCHED_MSG_LOG::CRITICAL,
"FILE=%s (%.0f bytes left) IP=%s caught signal %d [%s]\n",
"FILE=%s (%.0f bytes left) IP=%s caught signal %d [%s] run time %d seconds\n",
this_filename, bytes_left, get_remote_addr(),
signal_num, strsignal(signal_num)
signal_num, strsignal(signal_num), elapsed_time()
);
// there is no point in trying to return an error. At this point Apache has broken
@ -516,6 +518,7 @@ int main() {
int retval;
R_RSA_PUBLIC_KEY key;
char log_path[256];
elapsed_time();
installer();

View File

@ -106,8 +106,8 @@ void debug_sched(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& sreply, const char *t
//
void sigterm_handler(int signo) {
log_messages.printf(SCHED_MSG_LOG::CRITICAL,
"BOINC scheduler (pid=%d) caught signal %d. Exit(1)ing\n",
(int)getpid(), signo
"Caught signal %d [scheduler ran %d seconds]. Exit(1)ing\n",
signo, elapsed_time()
);
fflush(NULL);
exit(1);
@ -151,6 +151,9 @@ int main() {
int length=-1;
log_messages.pid = getpid();
// initialized timer
elapsed_time();
// install a signal handler that catches SIGTERMS sent by Apache if the cgi
// times out.
//

View File

@ -881,8 +881,8 @@ int send_work(
#endif
log_messages.printf(
SCHED_MSG_LOG::NORMAL, "[HOST#%d] Sent %d results\n",
reply.host.id, reply.wreq.nresults
SCHED_MSG_LOG::NORMAL, "[HOST#%d] Sent %d results [scheduler ran %d seconds]\n",
reply.host.id, reply.wreq.nresults, elapsed_time()
);
if (reply.wreq.nresults == 0) {

View File

@ -160,7 +160,7 @@ URLTYPE* read_download_list() {
);
for (i=0; i<count; i++) {
log_messages.printf(
SCHED_MSG_LOG::DEBUG, "zone=%+d url=%s\n", cached[i].zone, cached[i].name
SCHED_MSG_LOG::DEBUG, "zone=%+06d url=%s\n", cached[i].zone, cached[i].name
);
}
return cached;

View File

@ -222,4 +222,15 @@ void compute_avg_turnaround(HOST& host, double turnaround) {
host.avg_turnaround = new_avg;
}
int elapsed_time() {
static time_t execution_time=0;
if (!execution_time) {
execution_time=time(0);
return 0;
}
return (int)(time(0)-execution_time);
}
const char *BOINC_RCSID_affa6ef1e4 = "$Id$";

View File

@ -58,4 +58,8 @@ extern int extract_filename(char* in, char* out);
extern void compute_avg_turnaround(HOST& host, double turnaround);
// used to track execution time of cgi scripts
extern int elapsed_time();
#endif